-1
我想通过随机使用以下代码只在当前类别中获得5个帖子。在WordPress中获取当前类别中的5个随机帖子
// Get all posts within current category, but exclude current post
$category_posts = new WP_Query(array(
'cat' => $categories[0]->term_id,
'post__not_in' => array(get_the_ID()),
));
如何将'5职位'限制和'随机排序'应用于上述代码?
https://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters,https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters – CBroe