how to change taxonomy slug in wordpress

To change the taxonomy slug in WordPress, follow these steps:

  1. Access your WordPress dashboard.

  2. Navigate to "Plugins" and click on "Editor."

  3. From the right-hand side, select the theme for which you want to change the taxonomy slug.

  4. Locate and click on the "functions.php" file in the Theme Files list.

  5. Insert the following code at the end of the "functions.php" file:

function change_taxonomy_slug() {
    register_taxonomy(
        'your_taxonomy', // Replace 'your_taxonomy' with the actual taxonomy name
        'your_post_type', // Replace 'your_post_type' with the actual post type name
        array(
            'rewrite' => array( 'slug' => 'new-slug' ), // Replace 'new-slug' with the desired new slug
        )
    );
}

add_action( 'init', 'change_taxonomy_slug' );
  1. Replace 'your_taxonomy' with the actual taxonomy name, 'your_post_type' with the actual post type name, and 'new-slug' with the desired new slug.

  2. Click the "Update File" button to save the changes.

  3. Visit the Permalinks settings page to refresh the permalink structure. Navigate to "Settings" > "Permalinks" and click "Save Changes" without making any modifications.

Note: Always back up your website before making changes to the theme files, and ensure that you have access to your site files via FTP in case any issues arise.