Return to Snippet

Revision: 50624
at August 29, 2011 06:53 by thommeredith


Initial Code
function add_my_var($public_query_vars) {
    $public_query_vars[] = 'myvar';
    return $public_query_vars;
}

add_filter('query_vars', 'add_my_var');

function do_rewrite() {
    add_rewrite_rule('artists/(.+?)/(.+?)?$', 'index.php?pagename=artists/$matches[1]&myvar=$matches[2]','top');
}

add_action('init', 'do_rewrite');

Initial URL

                                

Initial Description

                                

Initial Title
Getting/Setting Variables Rewrite URL Wordpress

Initial Tags
wordpress

Initial Language
PHP