Custom Post Type and Taxonomy pagination 404 error

前端 未结 2 1263
-上瘾入骨i
-上瘾入骨i 2021-01-26 05:12

Pagination is not working on taxonomy.php. Here is my code for register custom post type and taxonomy

add_action(\'init\', \'ep_add_equipment\');
function ep_add         


        
2条回答
  •  不知归路
    2021-01-26 05:26

    // get the global query object
    global $wp_query;
    // get the correct page var
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    // create the page argument
    $args=  array('paged'=> $paged);
    // merge the page argument array with the original query array
    $args = array_merge( $wp_query->query, array( 'post_type' => 'equipment' ) );
    // Re-run the query with the new arguments
    query_posts( $args );
    

提交回复
热议问题