custom-post-type-permalinks icon indicating copy to clipboard operation
custom-post-type-permalinks copied to clipboard

"Use custom permalink of custom taxonomy archive" breaks if post_type has custom rewrite slug

Open codemonkeynorth opened this issue 7 years ago • 2 comments

(as noted here https://wordpress.org/support/topic/use-custom-permalink-of-custom-taxonomy-archive-producing-404/#post-9952476)

if Custom Post Type has a custom rewrite slug, then this plugin breaks when ticking "Use custom permalink of custom taxonomy archive"

you can go to /my-post-type/my-taxonomy/my-term but not /my-post-type-custom-slug/my-taxonomy/my-term

is there a way to intercept that in code? or might it be fixable in the plugin?

thanks J

(current workaround is to untick the box and set a custom slug for my-taxonomy to include the post type custom slug ie:
my-post-type-custom-slug/my-taxonomy. I'm not sure if this breaks anything.. it seems to play ok with Yoast so far)

codemonkeynorth avatar Feb 08 '18 13:02 codemonkeynorth

this diagram should explain it: image

My CPT = kitchen, my custom rewrite slug for that is fitted-kitchens My taxonomy is kitchen_category, my custom rewrite slug for that is style

with this ticked Use custom permalink of custom taxonomy archive:

this URL works http://localhost/kitchen/style/modern

this URL does not work, and gives a 404 http://localhost/fitted-kitchens/style/modern

you can see that the plugin is not processing the URL for the CPT rewrite slug properly

however for the first URL without the rewrite slug you can see Yoast is picking up the URL that it should be
<link rel="canonical" href="http://localhost/fitted-kitchens/style/modern" />

so somehow your plugin is not dealing with the custom slug, and hence the 404.

I hope that explains it

thanks J

again my workaround at the moment is to untick Use custom permalink of custom taxonomy archive and give my taxonomy a custom rewrite slug of fitted-kitchens/style instead of just style. ie I have to include the custom post type custom rewrite slug at the beginning of my taxonomy custom rewrite slug

this of course is a problem if 2 CPT's need to share the same taxonomy.

codemonkeynorth avatar Feb 09 '18 21:02 codemonkeynorth

+1

AdamWojda avatar Jun 01 '18 11:06 AdamWojda