Polylang and Rewrite Rules
-
Hello,
I am trying to add a rewrite rule but it doesn’t seem to be working at all and I think maybe I am not doing it correctly for it to work with Polylang. Here is the setup:
* I have a page at [language code]/stories/countries/ (‘stories’ is a parent page)
* I want to make it so that [language code]/stories/countries/[country-name] goes to the [language code]/stories/countries/ page with [country-name] as a query var called c_attr (I’ve already set up ‘c_attr’ as a query var using add_rewrite_tag)
In other words, the rewrite rule I am looking to use is (it’s a little more general because I have other pages that are siblings of ‘countries’ but they all behave similarly):
stories/([^/]+)/([^/]+)/?$ => index.php?pagename=$matches[1]&p_attr=$matches[1]&c_attr=$matches[2]
But this rule never seems to trigger and I suspect it is not playing nice with Polylang.
I found something about pll_rewrite_rules in the documentation, but I am not sure if it is indeed what I need, and if it is, I am not exactly sure as to how to use that sample code.
Thanks in advance for any help!
- The topic ‘Polylang and Rewrite Rules’ is closed to new replies.