-1

When defining a taxonomy I successfully set the slug base for it as well, all via functions.php. However, any change on the slug’s base (via editing functions.php again) is being recognised, i.e. it links to the right new URL, but lead to a 404. The term is still to be found at the original URL. More concrete:

  1. For the taxonomy slug definition I use 'rewrite' => array( 'slug' => 'countries' ) in my functions.php.
  2. The URL of a term is then e.g. www.xxx.com/countries/england
  3. I change the slug to 'rewrite' => array( 'slug' => 'regions' ).
  4. Frontend now links to www.xxx.com/regions/england, but produces a 404 – the term can still be found at www.xxx.com/countries/england.

Is there a way to savely edit and change the slug sitewide or is it a bug of sorts in WordPress? I tried flush_rewrite_rules(); in my functions.php after initialisation of the taxonomy, but still no luck.

  • Normal flushing the permalinks should fix it, IDK why it's not working for you, do you see a .htaccess file? – Nabil Kadimi Nov 18 '14 at 14:05
  • Is flush_rewrite_rules(); actually needed (I know, not permanently) when I hit the permalink options page anyway? In any way, there is a .htaccess file, yes, and working normally. So it should work out of the box when I already have created terms and posts for it, for the existing terms and posts as well? – physalis Nov 18 '14 at 22:57
0

Physalis, reset the permalinks from setting, it will work.

| improve this answer | |
0

As user9279 suggested (albeit a bit hard to understand), go to your Settings -> Permalinks and save them again. This tends to fix issues like this (as well as, for example, a 404 when viewing a newly created custom post type).

If this doesn't work, I suggest you look at the order of the registration for the taxonomy / post. The taxonomy should exist before the post utilizes it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.