douzao9845 2016-04-23 01: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条回答 默认 最新

      编辑
      预览

      报告相同问题?

      手机看
      程序员都在用的中文IT技术交流社区

      程序员都在用的中文IT技术交流社区

      专业的中文 IT 技术社区,与千万技术人共成长

      专业的中文 IT 技术社区,与千万技术人共成长

      关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

      关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

      客服 返回
      顶部