permalinks with get variables

I’m trying to create my own permalinks with wordpress rewrite API. I have been registering my get variables as it follows

add_filter( 'query_vars','driver_vars' );
function driver_vars( $vars ) {
    global $wp_query;
    array_push($vars, 'cat_name');
    array_push($vars, 'group');
    return $vars;
}

and making my own rule as it follows

function drivers_rewrite_rules( $rules ) {
    global $wp_rewrite;
    $newrules = array(
                        'drivers/([^/]+)/([^/]+)/([^/]+)/?$' =>   'index.php?pagename=drivers&cat_name=$matches[1]&group=$matches[2]&product=$matches[3]'
                      );
    $finalrules = $newrules + $rules;

    return $finalrules;
}

my rewrite rule is not getting executed on the second and third variable
when I var_dump($wp_query->query_vars) I see just my cat_name variable.

if I access with the following url structure than it’s okay

 ?pagename=drivers&cat_name=Desktops&group=Alienware

0

Leave a Comment