admin管理员组

文章数量:1122846

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.

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.

Share Improve this question edited Jul 2, 2011 at 9:34 Ramkumar M 8741 gold badge13 silver badges33 bronze badges asked Mar 3, 2011 at 21:39 Colin MorganColin Morgan 731 silver badge6 bronze badges 1
  • I would try to make it work with mod_rewrite rules in .htaccess. Is that an option? – Wietse Venema Commented Mar 5, 2011 at 20:16
Add a comment  | 

1 Answer 1

Reset to default 0

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?

本文标签: Custom rewrite rules for a page with GET variables