Isuru Liyanage
Isuru Liyanage

Reputation: 21

How to remove the category from the page url?

Is there any way to remove the "Project" term from the below permalink/url? www.fourmanteam.com/project/camping

I want the url in below order. www.fourmanteam.com/camping

I tried the custom structure. But, no help.

Thanks.

Upvotes: 0

Views: 72

Answers (2)

AddWeb Solution Pvt Ltd
AddWeb Solution Pvt Ltd

Reputation: 21691

I assume that, "Project" is your custom taxonomy.

So while registering your taxonomy you need to pass following rewrite rule:

$args = array(
            'hierarchical'      => true,
            'labels'            => $labels,
            'show_ui'           => true,
            'show_admin_column' => true,
            'query_var'         => true,
            'rewrite'           => array( 'slug' => '/' ),
        );
register_taxonomy( 'Project', array( [custom_post_type_slug] ), $args, array( 'rewrite' => array ('slug'=>'/')));

After applying this code, you need to flush rewrite rules. For that you just need to save permalink setting again.

Upvotes: 1

Amade
Amade

Reputation: 4008

You may want to consider using a Redirection plugin (or other similar). It won't change the permalink itself, but at least it will allow you to have a shorter link to the category page.

Upvotes: 0

Related Questions