Custom rewrite rules for a page with GET variables?

So basically I have a WordPress page called games. Within this page I have a list of custom post type posts. Using a form and some $_GET magic, the user is able to filter the posts based on tags, as well as, first letter in the title.

The base url for the page is:
localhost/gamesite/games/

The URL for the filter looks like this:
localhost/gamesite/games/?genre=audio-and-video&platform=ps3&alpha=A

The desired URL structure should look like this:
localhost/gamesite/games/audio-and-video/ps3/?alpha=A

I’m looking to use the native WordPress API to set these rules, instead of hacking the htaccess file. After reading several posts, I am unable to create any working form of the desired URL structure. More importantly than having the end code, I would like to learn how this process works. Any help would be greatly appreciated.

Answer

Here’s a nice explanation of how rewriting is done in WP:

http://ottopress.com/2010/category-in-permalinks-considered-harmful/

Also, might want to take a look at similar questions:

Writing Custom Rewrite Rules that Incorporate Category for Custom Post Types?

Attribution
Source : Link , Question Author : Colin Morgan , Answer Author : Community

Leave a Comment