Prettified page URL w/ query var redirects to prettified page URL w/o query var

I think you just have to add kategori to the array of query vars:

EDIT- after much iteration we’ve arrived at a solution. the original code seemed to be working, but only with specific permalink settings, as I was mistakenly routing to a post instead of a page. rather than p=, it should be pagename=, with both the parent and child page in the path:

function setup_filter_rewrites()
{
    add_rewrite_rule('sok/events/([^/]*)/?', 'index.php?pagename=sok/events&kategori=$matches[1]', 'top');
}
add_action( 'init', 'setup_filter_rewrites' );  

function setup_filter_query_vars( $query_vars )
{
    $query_vars[] = 'kategori';
    return $query_vars;
}
add_filter( 'query_vars', 'setup_filter_query_vars' );

Leave a Comment