-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