所以问题是redirect_guess_404_permalink
正在检测404错误并“猜测”/members/blog
未来/blog
我的黑客解决方案是挂接状态错误检查(Stop Wordpress from "guessing" redirects for nonexistent URLs) 如果URL部分匹配,则取消设置猜测的解决方案
function blog_no_redirect_guess_404_permalink( $header ){
global $wp_query;
if( is_404() ) {
// Get Request URL Parts
$url = parse_url($_SERVER[\'REQUEST_URI\']);
$path = explode(\'/\', $url[\'path\']);
$path = array_filter($path);
$path = array_merge($path, array());
// If matches /members/blog then unset \'guess\'
if (strtolower($path[0]) == \'members\' && strtolower($path[1]) == \'blog\') {
unset( $wp_query->query_vars[\'name\'] );
}
}
return $header;
}
add_filter( \'status_header\', \'blog_no_redirect_guess_404_permalink\' );