本文實(shí)例講述了Wordpress分類,標(biāo)簽,分頁(yè)顯示及翻頁(yè)出現(xiàn)404錯(cuò)誤的解決方法。分享給大家供大家參考。具體分析如下:
有不少朋友在使用wordpress博客時(shí)會(huì)碰到在分類,標(biāo)簽,分頁(yè)顯示,翻頁(yè)出現(xiàn)404錯(cuò)誤或找不到頁(yè)面的情況,這個(gè)問(wèn)題我也碰到了,下面給大家介紹一下解決方法.
在wordpresswp-includesclasses.php里面的handle_404方法 刪除&& !is_paged() 即可,代碼如下:
復(fù)制代碼
代碼如下:function handle_404() {
global $wp_query;
if ( !is_admin() && ( 0 == count( $wp_query->posts ) ) && !is_404() && !is_robots() && !is_search() && !is_home() ) {
// Don’t 404 for these queries if they matched an object.
if ( ( is_tag() || is_category() || is_tax() || is_author() ) && $wp_query->get_queried_object() && !is_paged() ) {
if ( !is_404() )
status_header( 200 );
return;
}
$wp_query->set_404();
status_header( 404 );
nocache_headers();
} elseif ( !is_404() ) {
status_header( 200 );
}
}
global $wp_query;
if ( !is_admin() && ( 0 == count( $wp_query->posts ) ) && !is_404() && !is_robots() && !is_search() && !is_home() ) {
// Don’t 404 for these queries if they matched an object.
if ( ( is_tag() || is_category() || is_tax() || is_author() ) && $wp_query->get_queried_object() && !is_paged() ) {
if ( !is_404() )
status_header( 200 );
return;
}
$wp_query->set_404();
status_header( 404 );
nocache_headers();
} elseif ( !is_404() ) {
status_header( 200 );
}
}
希望本文所述對(duì)大家的WordPress建站有所幫助。
【網(wǎng)站聲明】本站除付費(fèi)源碼經(jīng)過(guò)測(cè)試外,其他素材未做測(cè)試,不保證完整性,網(wǎng)站上部分源碼僅限學(xué)習(xí)交流,請(qǐng)勿用于商業(yè)用途。如損害你的權(quán)益請(qǐng)聯(lián)系客服QQ:2655101040 給予處理,謝謝支持。