Hi I'm having an issue while rewriting a url like this "news/category_name_here/page_num_here" when I already have a page with the link of "news" it seems to be always considering the first parameter as something else and not the get_query_var
I gave it, e.g. category_name_here wouldn't be defined in the call to get_query_var()
Here is my code I was explaining:
function prefix_register_query_var( $vars ) {
$vars[] = 'cat';
$vars[] = 'pagenum';
return $vars;
}
add_filter( 'query_vars', 'prefix_register_query_var' );
function custom_rewrite_rule() {
add_rewrite_rule('^news/([^/]*)/([^/]*)/?','index.php?page_id=51&cat=$matches[1]&pagenum=$matches[2]','top');
flush_rewrite_rules();
}
add_action('init', 'custom_rewrite_rule', 10, 0);
Thanks in advance.