douzao9845 2016-04-23 09:49 采纳率: 0%
浏览 18

按邮政对象自定义字段过滤自定义帖子类型

I have post types named "tour" and "country". "tour" post type has some custom fields and type of one of them is Post Object and filtered by Post Type "country".

Now I want to show tours filtered by a specific country, for example:

$located_tours = get_posts(array(
    'numberposts'   => 3,
    'post_type'     => 'tour',
    'meta_key'      => 'country',
    'meta_value'    => 'turkey'
));

But the result for this query shows nothing.

I know "country" I have used as meta_key is an object, but how can I use it correctly in my query?

Anyone has any idea? Thanks

  • 写回答

0条回答 默认 最新

    报告相同问题?