2

Please help me in wordpress.

I want to remove custom texnonomy base from URL in wordpress

http://domainname/travel-category/beaches
to 
http://domainname/beaches

where "travel-category" is custom register taxonomy base and "beaches" is category

MY CODE IS :

register_taxonomy(
                'travel-category', //taxonomy base
                'destination', // custom post type
                 ...
            );

1 Answer 1

2

DO one thing add the following code for the rewrite argument for register_taxonomy function:

'rewrite' => array( 'slug'  => '/',  'with_front' => FALSE ),

Hope this works and if not try refreshing the permalink page.

Sign up to request clarification or add additional context in comments.

3 Comments

This breaks page/post urls.
This fixes the taxonomy url but 404s every other page on the site.
This works for me, thanks.Context: building website with 2 CPTs (with similar rewrite array in their register_post_type() args array. Aim: have URLs like /<term>/<CPT1 post name> and /<term>/<CPT2 post name> (and be careful to never have CPT1 and CPT2 posts name conflict.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.