How to change custom post type keys (necessary to change the sitemap links generated by the Yoast SEO plugin).

Home » How to change custom post type keys (necessary to change the sitemap links generated by the Yoast SEO plugin).

There are only three files where you need to change the custom post type keys:

For Mercury theme:
wp-content/themes/mercury/functions.php


For ACES plugin:
wp-content/plugins/aces/index.php


For Mercury Addons plugin:
wp-content/plugins/mercury-addons/index.php


Important! Before changing the keys, you need to make a backup of the database. If items were previously added to the post types whose keys will be changed, they will disappear from the admin panel. To return them after the changes, you need to run this query for the site database. This can be done through the phpmyadmin panel.

UPDATE `wp_posts`
SET 
    # Update the post_type column
    `post_type` = REPLACE(`post_type`,'casino','name_of_new_post_type'),
    # Update the urls
    `guid` = REPLACE(`guid`,'casino','name_of_new_post_type')
WHERE `post_type` = 'casino'

The name_of_new_post_type value needs to be replaced with the new key.

Important notice!
Before updating or making any changes, back up your site.

© Copyright 2024 Mercury Theme
Powered by WordPress | Mercury Theme