1

I'm trying to change the permalink structure for a custom taxonomy on a custom post type. The custom post type has the slug resources and custom taxonomy has the slug category. As an example, I've created the taxonomy term ebooks. At the moment through the "Permalinks" panel I can get the structure as below:

http://localhost/resources/ebooks/my-new-post/
http://localhost/resources/category/ebooks/

How can I achieve:

http://localhost/resources/ebooks/my-new-post/
http://localhost/resources/ebooks/

The latter URL being the archive for the ebooks term.

1

Depending on how you are registering your custom post types, you can simply set the rewrite rules for it like so:

$args = array(
        'description' => 'Photograph Post Type',
        'label' => __('Photographs'),
        'public' => true,
        'rewrite' => array( 'slug' => 'photograph'),
);

register_post_type( 'photograph' , $args );

If (for some bizarre reason) you don't have access to modify the way in which your custom post types are being registered, try setting the "category base" to "." within the Permalinks menu in your admin panel, and make sure that your permalink structure is set to /%category%/%postname%/. That's worked for me in the past.

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.