1、关于中文Tag标签404问题,网上已有不少解决方案,可直接查阅解决,以下为链接之一:
http://blog.youkuaiyun.com/waitig1992/article/details/39268707
2、关于tag标签页做分页处理,点击页码有时会报404,解决方法如下:
/wp-includes/class-wp.php 的 handle_404()方法
// We will 404 for paged queries, as no posts were found. if ( ! is_paged() ) { // Don't 404 for authors without posts as long as they matched an author on this site. $author = get_query_var( 'author' ); if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) ) { status_header( 200 ); return; } // Don't 404 for these queries if they matched an object. if ( ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() ) { status_header( 200 ); return; } // Don't 404 for these queries either. if ( is_home() || is_search() || is_feed() ) { status_header( 200 ); return; } }
原因是,页面加载时$wp_query->posts 查询结果为空数组,WP分页后默认会按404处理,修改代码如下:
// We will 404 for paged queries, as no posts were found. if ( ! is_paged() ) { // Don't 404 for authors without posts as long as they matched an author on this site. $author = get_query_var( 'author' ); if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) ) { status_header( 200 ); return; } // Don't 404 for these queries if they matched an object. if ( ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() ) { status_header( 200 ); return; } // Don't 404 for these queries either. if ( is_home() || is_search() || is_feed() ) { status_header( 200 ); return; } } //Tag页分页不显示404 --------------begin else { if ( is_tag() ) { status_header(200); return; } } //Tag页分页不显示404 --------------end
问题解决,同理,文章分类、自定义分类页如需做分页时,也需要做如上修改。