Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
codemonkeynorth opened this issue Feb 8, 2018 · 2 comments
Labels

Comments

@codemonkeynorth
Copy link

codemonkeynorth commented Feb 8, 2018

(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
Copy link
Author

codemonkeynorth commented Feb 9, 2018

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.

@AdamWojda
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants