admin管理员组文章数量:1122832
Trust you are well. I need your help to fix pagination issues for my custom post type archives.
At first, it was my homepage but I managed to fix it with a few function codes which I thought would also work for archives "is_archive() || is_post_type_archive() || is_tax()
" but not.
Please help me out.
This is the code that fixed pagination showing 404 error for the homepage:
add_action( 'pre_get_posts', 'changept' );
function changept( $query ) {
if ( ! is_admin() && $query->is_main_query() ) {
// Modify the query for the homepage
if ( is_home() ) {
$query->set( 'post_type', array( 'post', 'mp3-download', 'entertainment', 'people', 'videos' ) );
}
}
}
本文标签: Custom Post Type Pagination Showing 404 On archive pages
版权声明:本文标题:Custom Post Type Pagination Showing 404 On archive pages 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736312192a1935010.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论