I need to add “item/” prefix to post url only

I went to Settings -> Permalinks and set this :

/item/%postname%/

and for category and tag set this:

category
tag

But other post_type and taxonomies and author has “item/” prefix

I try correct author URL with this code:

add_action('init', 'ztcom_custom_rewrite_basic');
function ztcom_custom_rewrite_basic() {
   global $wp_rewrite;
   $wp_rewrite->author_base="author";
   $wp_rewrite->author_structure="https://wordpress.stackexchange.com/" . $wp_rewrite->author_base . '/%author%';
   add_rewrite_rule('author/([^/]+)/?$', 'index.php?author_name=$matches[1]', 'top');
}

But I don’t know how to correct other post type and taxonomies

or how to change only post URL structure

2 Answers
2

You have to set with_front to false when you register your taxonomy or post type to not have the prefix included in the URLs.

Leave a Reply

Your email address will not be published. Required fields are marked *