Wordpress分类,标签,分页显示及翻页出现404错误的解决方法
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>本文实例讲述了Wordpress分类,标签,分页显示及翻页出现404错误的解决方法。分享给大家供大家参考。具体分析如下:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
有不少朋友在使用wordpress博客时会碰到在分类,标签,分页显示,翻页出现404错误或找不到页面的情况,这个问题我也碰到了,下面给大家介绍一下解决方法.</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
在wordpresswp-includesclasses.php里面的handle_404方法 删除&& !is_paged() 即可,代码如下:<br>
</p>
<div style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<div style="margin: 0px; padding: 0px; outline: none; float: right; line-height: 25.2px; font-size: 14px;">
<span style="line-height: 25.2px; cursor: pointer;"><u>复制代码</u></span>
</div>
<p>
代码如下:</p>
</div>
<div id="phpcode1" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
function handle_404() { <br>
global $wp_query; <br>
if ( !is_admin() && ( 0 == count( $wp_query->posts ) ) && !is_404() && !is_robots() && !is_search() && !is_home() ) { <br>
// Don’t 404 for these queries if they matched an object. <br>
if ( ( is_tag() || is_category() || is_tax() || is_author() ) && $wp_query->get_queried_object() && !is_paged() ) { <br>
if ( !is_404() ) <br>
status_header( 200 ); <br>
return; <br>
} <br>
$wp_query->set_404(); <br>
status_header( 404 ); <br>
nocache_headers(); <br>
} elseif ( !is_404() ) { <br>
status_header( 200 ); <br>
} <br>
}</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
希望本文所述对大家的WordPress建站有所帮助。</p>
頁:
[1]