wordpress给指定ID的分类目录分页添加不同数量文章

function jzp_wp_filter_pre_get_posts($query)
{
    if ($query->is_main_query()) { 
        $num = '';
        if (is_category(array(38))) {  
            $num = 999;
            $query->set('posts_per_page', $num); 
        }
    }
    return $query;
}

add_action('pre_get_posts', 'jzp_wp_filter_pre_get_posts');

最后更新日期: 2024:1:5:16:47