更新日期:2021-03-12
以前流行將文章分頁,或許是為了SEO搜尋考量,讓網友能多點擊更多的頁面,不過真的沒什麼效果。若是想要取消以前留下來的分頁標記,必須一篇一篇去改,底下教你快速隱藏方法,不用再去改文章內容。
add_filter('the_posts', function($posts,$qry){
if ($qry->is_single() ) {
$posts[0]->post_content = preg_replace( '/<!--nextpage(.*?)?-->/', '', $posts[0]->post_content );
}
return $posts;
},1,2);
add_filter('content_pagination', function($pages) {
$pages = [ join( '', $pages ) ];
return $pages;
});
相關文章參考:
https://wordpress.stackexchange.com/questions/208760/how-to-disable-content-pagination/208784
發佈留言