get_posts 不是 return 所有 post,有多个自定义 post 类型

get_posts not return all post, with multiple custom post type

感谢阅读

我已经传递了包含以下参数的 $args 变量。 这个 args 变量传入 get_posts 方法。 它只会给出 quiz_4,quiz_0 个帖子。我哪里做错了

Array
(
    [posts_per_page] => 20
    [paged] => 1
    [post_type] => Array
        (
            [0] => quiz_4
            [1] => quiz_0
            [2] => quiz_5
            [3] => quiz_3
            [4] => quiz_2
            [5] => quiz_1
            [6] => password
        )
    [orderby] => menu_order title
    [order] => ASC
    [post_status] => any
    [suppress_filters] => 
    [update_post_meta_cache] => 
)

尝试 numberposts => 20 而不是 posts_per_page

$args

(array) (可选)检索帖子的参数。有关所有可用参数,请参阅 WP_Query::parse_query()

'numberposts' (整数)要检索的帖子总数。是 WP_Query 中 $posts_per_page 的别名。全部接受-1。默认 5.

参考:

https://developer.wordpress.org/reference/functions/get_posts/