This article describes how we are updating the dealers meta titles and descriptions in order for each dealer to have custom and unique metas.

Here is some observations before we explain how this is done because this update is very advanced.

1. On Brandcore we are querying the get_dealer_map (see. https://api.arcticspascore.com/docs/get_dealer_map/) in order to get the basic dealer data from the dealer core system. This query is run every 60 minutes to check for new dealers.

The function for this can be found within the brand core plugin in the functions.php file called brand_core_sync_dealer_store_pages();

2. If a new dealer is found, we create a new dealer record under the post type “stores”. We only add the dealers store name to the post_title and their dealer_id into a custom field called dealer_id, this simple data saves database overhead and updating speeds.

3. If the dealer already exists, then we only update the _yoast_wpseo_title and _yoast_wpseo_metadesc fields in the post_meta table, nothing else.

4. If the dealer has populated “other areas” field in dealer core, then we will add the other areas to the metas.

Here is an example showing how we structure the metas based on the variable of other areas being absent or not.

HOW TO RESTRUCTURE THE YOAST METAS IN THE PLUGIN

1. Open plugin file: arcticspas-brandcore-plugin/functions.php
2. Go to brand_core_sync_dealer_store_pages()
3. Find the line which says “$yoast_wpseo_title”
4. Edit the format of the metas.

Currently we are updating the dealers every 60 minutes, so if you make a change to the metas this wont be reflected for at least an hour. If you want quicker changes then find the setting in the function called: $seconds_beteween_updates and change that from 3600 to 10 seconds*.

*WARNING: make the interval period long like 1 hour otherwise the db is updating all the time. In fact a better setting would be to run it daily like 86,400 seconds