您需要自己添加重写规则。此代码应适用于:
function prefix_this_add_rewrite_rules() {
// Add day archive (and pagination)
add_rewrite_rule( \'/([0-9]{4})/([0-9]{2})/([0-9]{2})/page/?([0-9]{1,})/?\', \'index.php?post_type=cats&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]\', \'top\' );
add_rewrite_rule( \'cats/([0-9]{4})/([0-9]{2})/([0-9]{2})/?\', \'index.php?post_type=cats&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]\', \'top\' );
// Add month archive (and pagination)
add_rewrite_rule( \'cats/([0-9]{4})/([0-9]{2})/page/?([0-9]{1,})/?\',\'index.php?post_type=cats&year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]\', \'top\' );
add_rewrite_rule( \'cats/([0-9]{4})/([0-9]{2})/?\', \'index.php?post_type=cats&year=$matches[1]&monthnum=$matches[2]\', \'top\' );
// Add year archive (and pagination)
add_rewrite_rule( \'cats/([0-9]{4})/page/?([0-9]{1,})/?\', \'index.php?post_type=cats&year=$matches[1]&paged=$matches[2]\', \'top\' );
add_rewrite_rule( \'cats/([0-9]{4})/?\', \'index.php?post_type=cats&year=$matches[1]\', \'top\' );
}
如果在插件中执行此操作,则需要在激活时调用此函数(通过register\\u activation\\u hook()),然后刷新重写规则。在主题中,连接到after\\u switch\\u主题。
您可以使用此插件帮助您进行调试:http://wordpress.org/extend/plugins/rewrite-rules-inspector/