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