Custom Type Post with custom rewrite rules
-
Hi, If this is not the proper section to post this question, please let me know.
I have registered a custom post type referred to business lists which uses as slug /businesses-lists/
Also have set a custom permalink structure as follow:
/%post_id%/%category%/%postname%/
And also added a few rewrite rules to establish different details on the post content:
[rules] => Array ( [businesses-lists/(.+?)/detail/(.+?)/(.+?)/(.+?)$] => index.php?business_list=$matches[1]&r2name=$matches[2]&r2content=$matches[3]&r2subname=$matches[4] [businesses-lists/(.+?)/detail/(.+?)/(.+?)$] => index.php?business_list=$matches[1]&r2name=$matches[2]&r2content=$matches[3] [businesses-lists/(.+?)/detail/(.+?)$] => index.php?business_list=$matches[1]&r2name=$matches[2] )
In brief, the WP_rewrite is set as follow:
WP_Rewrite Object ( [permalink_structure] => /%post_id%/%category%/%postname%/ ... [rules] => Array ( [businesses-lists/(.+?)/detail/(.+?)/(.+?)/(.+?)$] => index.php?business_list=$matches[1]&r2name=$matches[2]&r2content=$matches[3]&r2subname=$matches[4] [businesses-lists/(.+?)/detail/(.+?)/(.+?)$] => index.php?business_list=$matches[1]&r2name=$matches[2]&r2content=$matches[3] [businesses-lists/(.+?)/detail/(.+?)$] => index.php?business_list=$matches[1]&r2name=$matches[2] ....
The main problem is that I do not get the additional rewrite rules working, when I access an url like /businesses-list/bl1/detail/bss/ get redirect to /businesses-list/bl1/
After reading a lot and checking possible rewrite conflicts, when changed the permalink structure, taking away %category%, it works with any other combination !
For example:
[permalink_structure] => /%post_id%/%year%/%postname%/
Thank you in advance
- The topic ‘Custom Type Post with custom rewrite rules’ is closed to new replies.