Change Category Base For Custom Post Type or Posts Page


I have a few questions and I don’t think the outcome I want is possible without adding a custom taxonomy and redoing a bunch of work.

I have registered a custom post type – gallery – with taxonomies set to post_tag and category.

I have the permalink structure set to /blog/%postname%/ so Posts can have the /blog/ base set using the default Posts section within WordPress.

When I use get_category_link() for a category on the gallery custom post type, it links to /blog/ceremonies/ instead of /gallery/ceremonies/ which is what I’d like for anything on the gallery archive or single gallery page. For the blog, it would need to be /blog/category_name/ as it currently is.

I know I can do the work from this question, but I have a lot of work done already that I do not want to back track on.

My questions:

Is there a way have /blog/ceremonies/ and /gallery/ceremonies/ load the same categories, and I can filter them with what the /blog/ or /gallery/ is set to in the URL with $_SERVER[‘REQUEST_URI’] (or something similar) without creating a custom taxonomy?

If not (I don’t think there is), is there a way I can strip out the /blog/ out of the custom permalink so it just shows /ceremonies/ and still have /blog/ at the beginning of anything posted in the “Posts” section?

Any help is appreciated. Thank you!

, Devyn 2 years 2020-01-05T09:41:59-05:00 0 Answers 83 views 0

Leave an answer