[wp-hackers] Update Plugin Rewrite Rules

Mr.Brown mrbrog at gmail.com
Thu Feb 2 22:39:05 GMT 2006


Jamie Talbot wrote

[cut]

>  Try this and see if it works:
>
> add_filter('query_vars', 'RTS_query_vars');
> add_filter('rewrite_rules_array', 'RTS_pics_rewrite');
>
> // Define the language query variable.
> function RTS_query_vars($vars)
> {
>         $vars[] = 'album';
>         return $vars;
> }
>
> function RTS_pics_rewrite(& $rewrite)
> {
>         $keytag_token = '%pics%';
>         $wp_rewrite->add_rewrite_tag($keytag_token, '(.+)', album=');
>         $keywords_structure = $wp_rewrite->root . "pics/$keytag_token";
>         $rewrite[] = $wp_rewrite->generate_rewrite_rules($keywords_structure);
> }
>
> Hope this helps, or at least gives you a starting point,

Thanks for the answer, but unfortunately it doesn't work. At this
point I have no ideas... I tried also the other example on the Codex
:-(

I try to semplify the question: it is possible in 2.0.1 to pass a
variable to a Page in this way
mysite.com/page-slug/var/ ???
It is possible using rewrite rules? And in which way it is possible?

Thanks again
Mr.Brown


More information about the wp-hackers mailing list