How to add adjusted rules with the help of add_url_rewrite WordPress function for dynamic query variables

How to add adjusted rules with the help of add_url_rewrite WordPress function for dynamic query variables

1 minute, 8 seconds Read

I try to add adapted Rewirte rule/amming with add_url_rewrite in the WordPress website

Scenario

https://www.example.com/1pagename;/? Office = OfficeValue
https://www.example.com/{pagename;/? Office = OfficeValue & Location = LocationValue

I want them if

https://www.example.com/{pagename;/{officeValue}
or
https://www.example.com/{pagename;/{officeValue}/{locationValue}

I want the TO GET Request/Variable on the page and also wants to use URLs without the above parameters, because {Pagename} is already given by WordPress, it also happens that page name is most times parent/child/sub child Structure and then the URL parameters are mentioned, so in principle these variables are not elements in the WordPress but free variables and I want to use their values in the page capacity

Examples are available on Stackexchange But they do not correspond to my requirement that I am confused with Regex rule, starting with a fixed name such as "/foo/(regex)/ Like this and I don’t have a deep understanding of Regex, so it’s confusing, you can please help me to reach expected URLs and also use the last 2 or last 1 as query string parameters or also receive request variables

Beautiful links are engaged as a post name permalinks I don’t know much about writing rules in WordPress, so I try struggling

Thank you in advance

#add #adjusted #rules #add_url_rewrite #WordPress #function #dynamic #query #variables

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *