Running into a weird rewrite rule on the dev server - with DevKinsta local, the URL is showing correctly: https://internationalmidwivesorg.local:51343/resources/?paged=2&search=icm
However, when I push to dev, it rewrites the ?paged query var to this: https://stg-internationalmidwivesorg-dev.kinsta.cloud/resources/page/2/?search=icm
We need to keep it as a paged query var and not rewrite to /page/2 - but not seeing why it would do that on dev and not on local, given we’re using the same theme files across both.
The only rewrite rules we have in the theme are these (intended to make sure archive listing pagination works right when nested by post type, and these all seem to work correctly):
add_action( 'init', function() {
$taxonomies = array(
'category',
'region',
'project',
'resource_type',
'authors'
);
$types = array(
'projects',
'resources'
);
// Loop through taxonomies
foreach( $taxonomies as $taxonomy ) {
// Loop through custom post types and rewrite
foreach ( $types as $type ) {
add_rewrite_rule( '^' . $type . '/' . $taxonomy . '/([^/]+)/?$',
'index.php?post_type=' . $type . '&taxonomy=' . $taxonomy . '&term=$matches[1]', 'top' );
add_rewrite_rule( '^' . $type . '/' . $taxonomy . '/([^/]+)/page/([0-9]+)?$',
'index.php?post_type=' . $type . '&taxonomy=' . $taxonomy . '&term=$matches[1]&paged=$matches[2]', 'top' );
}
// Rewrite rules for posts as "news"
add_rewrite_rule( '^news/' . $taxonomy . '/([^/]+)/?$',
'index.php?post_type=post&taxonomy=' . $taxonomy . '&term=$matches[1]', 'top' );
add_rewrite_rule( '^news/' . $taxonomy . '/([^/]+)/page/([0-9]+)?$',
'index.php?post_type=post&taxonomy=' . $taxonomy . '&term=$matches[1]&paged=$matches[2]', 'top' );
}
}, 10, 0 );
Note that the pagination link is correct when I hover on the page number, but then it’s rewriting it somewhere when I actually click on it.