In wordpress I need to prefix the permalink with a custom taxonomy tag lets say %writer% and maintain the standard category structure after that.
For e.g
/steve-brookes/novels/thrillers/
Where novels/thrillers is the standard hierarchical category structure. So i dont need to recreate the category structure for each writer.
I can persist this tag no problem in a session variable grabbing get_query_var(‘writer’); and modify the url to suit using this to persist the writer tag. This maintains the tag when navigating through the categories. Until you go back and change the writer.
I thought I had achieved this however prefixing the permalink seems to create issues with pages throwing 404 errors, as the pages dont have a category prefix and WP thinks the page name is a writter.
I can append the tag to the end of the permalink and there is no problem:
/%category%/%postname%/%writer%/
/novels/thrillers/steve-brookes/
all works as expected including pages.
But doing this:
/%writer%/%postname%/%category%/
/steve-brookes/thrillers/novels/
Causes pages to throw 404 errors.
I know there are plenty of posts on this on SO and the web but doesnt seem to cover this.
Any help appreciated.
Working with the same problem right now. Trying to add my taxonomy slug at the beginning of my permalinks.
It seems that when you make first permalink section dynamic, it creates a conflict with the pages structure, which consists only from one dynamic section – %pagename%.
I haven’t succeeded with rewrite rules to bypass it.
The only workaround I found yet is to make pages permastructure more specific: