[wp-hackers] Rewrite Rules

Michael Van Winkle mike at mikevanwinkle.com
Thu Feb 3 17:11:21 UTC 2011


Hey Ryan, check out this page in the Codex.
http://codex.wordpress.org/Function_Reference/WP_Rewrite

WordPress has two key filters for this:
rewrite_rules_array (actually adds the rewrite rule)
query_vars (adds rewrite rule/variable to the wp_query object)

Cheers,

Mike


On Wed, Feb 2, 2011 at 6:11 PM, Ryan Bilesky <rbilesky at gmail.com> wrote:
> I am looking to add rewrite rules for my plugin, my plugin will have a
> shortcode embedded in a page, lets just say for example the url is
> http://mysite.com/page I want a rewrite rule to get a url like this
> http://mysite.com/page/something-here where something-here is a GET
> parameter, it woul dbe like the url
> http://mysite.com/page/?something=something-here, you get my point the page
> will accept a GET parameter and I just want to rewrite the URL to make it
> look better.  First off, my guess is yes, but just to make sure this is
> possible right?  And the big question is how?  I haven't worked with rewrite
> rules in wordpress before, now if I was to use .htaccess the rewrite rule
> would look like this:
>
> RewriteRule ^page/([^/]*)$ /page/?something=$1 [L]
> How do I add this to the WordPress rewrite rules?
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Mike Van Winkle
708-289-3136
mike at mikevanwinkle.com
http://www.mikevanwinkle.com
http://www.twitter.com/mpvanwinkle
http://www.facebook.com/mpvanwinkle


"All excellent things are as difficult as they are rare." -Spinoza


More information about the wp-hackers mailing list