Search code examples
phpwordpresspermalinks

Dynamic Parameter in url in Wordpress


I am trying to set and get the value from the url in wordpress. What i mean is following;

My current page url

http://www.myurl.com/pageName

What i want is

http://www.myurl.com/pageName/some-dynamic-text

when i try to do so it redirect me to not found page. I only want to do this on one specific page

My permalink is Post name http://www.myurl.com/sample-post/


Solution

  • You need to use add_rewrite_rulewordpress API, as shown https://codex.wordpress.org/Rewrite_API/add_rewrite_rule