wordpresspermalinksslugcustom-taxonomy

Wordpress Permalinks showing as updated, but all links still point to old permalink


I have a custom taxonomy setup, called Product Categories. If I create a category, say for example "Cattle" and set the slug to /cattle/ - when I goto site.com/product-category/cattle it works fine.

However, if I then go into the wp-admin, and edit the slug of the category, to /cattle-feed/, ALL the links to this particular category still show as /cattle/ - both in the admin panel (if I click "view" on the category), in wp-menu, and on the front-end when using "get_category_link()".

/cattle/ becomes a 404 (which it should). /cattle-feed/ becomes the correct taxonomy category archive (which it should). All of the links in admin, wp-menu and on the front-end goto /cattle/, but it's correctly set as /cattle-feed/

Edited slug after creation, not updating on view (and other areas)

Here is the taxonomy code:

 
add_action( 'init', 'west_create_products_category_taxonomy', 0 );
 
//create a custom taxonomy name it subjects for your posts
 
function west_create_products_category_taxonomy() {
  
  $labels = array(
    'name' => _x( 'Product Categories', 'taxonomy general name' ),
    'singular_name' => _x( 'Product Category', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Categories' ),
    'all_items' => __( 'All Categories' ),
    'parent_item' => __( 'Parent Category' ),
    'parent_item_colon' => __( 'Parent Category:' ),
    'edit_item' => __( 'Edit Category' ), 
    'update_item' => __( 'Update Category' ),
    'add_new_item' => __( 'Add New Category' ),
    'new_item_name' => __( 'New Category Name' ),
    'menu_name' => __( 'Product Categories' ),
  );    
 
// Now register the taxonomy
  register_taxonomy('product_category',array('products', 'post'), array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_in_rest' => true,
    'show_admin_column' => true,
    'query_var' => true,
    'has_archive' => true,
    'rewrite' => array( 'slug' => 'product-category' ),
  ));
 
}

I've tried flushing the permalinks. What have I missed here?


Solution

  • This turned out to be an issue with WPML plugin, which was stopping the slugs from updating. The fix was to go into WPML > Support > Troubleshooting, and then push the all the buttons under "Clean Up". (Their support told me to push them all!).

    Ridiculous, but hey ho - it's solved!