I am trying to use add_rewrite_rule() to solve a pagination problem I am having. After a lot of research I know the answer. But it seems the second argument of add_rewrite_rule() is never working.
add_action( 'init', 'add_category_base_rewrite_rule' );
function add_category_base_rewrite_rule() {
add_rewrite_rule(
'publicacoes/(.+?)/page/?([0-9]{1,})/?$',
'index.php?post_type=artigo&category_name=$matches[1]&paged=$matches[2]',
'top'
);
}
I am using the plugin Debug This to check the rewrite rules
As you can see the second argument doesn't match what I put in my function. And no matter what I do it doesn't work.
I know the function is being called because it put my rule on the top.
What I am doing wrong?