WordPress URL Rewrite not working

first, you should use the proper filter and method to add query vars and rewrite rules and not manipulate the globals directly. the other issue I believe is your regex pattern, this is working for me:

add_filter( 'query_vars', 'wpa59404_query_vars' );
function wpa59404_query_vars($query_vars){
    $query_vars[] = 'update_slug';
    return $query_vars;
}

add_action( 'init', 'wpa59404_rewrites' );
function wpa59404_rewrites(){
    add_rewrite_rule(
        'updates/plugins/([^/]+)/?$',
        'index.php?update_slug=$matches[1]',
        'top'
    );
}

Leave a Comment