Custom Post Type and Taxonomy pagination 404 error

前端 未结 2 1284
-上瘾入骨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:47

    May be you need to enable search to enable pagination

    While declaring custom taxonomy you should disable search excluding.

    exclude_from_search => false

    This fixed my problem. I have very hard time to find this solution. Hope this helps everyone.

    My code is:

    register_post_type( 'lifestyle',
                    array( 
                    'label' => __('Lifestyle', 'tmi'), 
                    'public' => true, 
                    'show_ui' => true,
                    'show_in_nav_menus' => true,
                    'rewrite' => true,
                    'hierarchical' => true,
                    'menu_position' => 5,
                    'exclude_from_search' =>false,
                    'supports' => array(
                                         'title',
                                         'editor',
                                         'thumbnail',
                                         'excerpt',
                                         'revisions')
                        ) 
                    );
    
        register_taxonomy('lifestylecat', __('lifestyle', 'tmi'),array('hierarchical' => true, 'label' =>  __('Categories', 'tmi'), 'singular_name' => __('Category', 'tmi'))
        );
    

提交回复
热议问题