>我有帖子,匹配 2 个类别。亲子>1尝试仅从 child1 类别获取帖子,但 wordpress 仅在具有 1 个类别时才显示帖子。
例:
帖子 1.分类目录: 亲子, 儿童1
帖子 2.类别: 儿童1
我使用
$args = array( 'posts_per_page' => 20, 'orderby' => 'date', 'post_type' => 'post', 'category' => $Child1_category_id );
$postslist = get_posts( $args );
但它只返回帖子 2。我需要获得帖子 1 和帖子 1。
我做错了什么?谢谢!
尝试使用这种类型的参数:
如果不起作用,请尝试使用query_posts中的"父级"。