A canonical redirect:
The GET parameter m
can trigger a canonical redirect when permalinks are used.
The canonical redirects are activated with the following hook:
add_action('template_redirect', 'redirect_canonical');
where redirect_canonical()
is a rather complicated function.
Here’s the skeleton of the part that’s active within this “monster” callback:
// ... cut ...
if ( is_404() ) {
// ... cut ...
} elseif ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) {
if( ... ) {
// ... cut ...
} elseif ( !empty($_GET['m']) && ( is_year() || is_month() || is_day() ) ) {
// --> We are here <--- ;-)
} elseif( ... ) {
// ... cut ...
}
// ... cut ...
where $_GET['m']
is non-empty.
In your case when $m
has the YYYYMM
format, is_month()
is also true and we get the following redirect:
$redirect_url = get_month_link( substr($m, 0, 4), substr($m, 4, 2) );
so we should be redirected from:
http://example.tld/category/category-1/?m=201503
to:
http://example.tld/2015/03
A possible workaround would by to use instead:
http://example.tld/2015/03/?cat=16
to avoid the canonical redirect process.
You should also try this on a vanilla install: default theme and no plugins to avoid your infinite redirect loop problem.