I have the following page which contains a single post and a number of comments:
http://mysite.com/tips
When a user posts a comment, I add meta-data to it so I can filter comments by using these URL’s:
http://mysite/tips?id=cat&filter_id=1
http://mysite/tips?id=dog&filter_id=2
I want to use the following url’s instead:
http://mysite/tips/cat
http://mysite/tips/dog
The tips page displays a list of posts based on the query string parameters.
I worked through this tutorial, which seemed to be what I needed, but when I type in my url, I get a page not found error.
http://thereforei.am/2011/10/28/advanced-taxonomy-queries-with-pretty-urls/
Is this possible?
You can add a rewrite rule such as the following. Make sure to register your public query vars with WordPress so it recognizes your rewrite rule vars.
Visit the Permalinks Settings page to flush your permalinks.
You can access your variables as follows:
Note, you’re wanting to have two dynamic variables with one URI segment which won’t work at all. The rewrite rule above works for tips/cat/1 (1 being the filter_id).
To test your rules, I highly recommend you to use the Monkeyman Rewrite Analyzer.
Hope this helps you out!
You can use the
add_query_arg
funtion:Now the URLs read as follows:
http://mysite/tips/cat?filter_id=1
http:// mysite/tips/dog?filter_id=2
You can get the arguments’ values as follows:
Here is more infomation about
add_query_arg
I Think you want to change the Permalink Style You can change the Permalink of your website through admin panel of WordPress go to WordPress and then in the sidebar menu go to setting and then there you will see a sub-menu of Permalink click it and you will see many Types of Permalinks provided by wordpress you can also make your custom permalink. Check out the Picture Hope it might help: