我正在尝试获取应用了元值的帖子trainees
.
$args = array(
\'posts_per_page\' => -1,
\'orderby\' => \'post_date\',
\'order\' => \'DESC\',
\'post_status\' => \'publish\',
\'meta_query\' => array(
array(
\'key\' => \'enterprise_on_page\',
\'value\' => array( \'trainees\' ),
\'compare\' => \'IN\',
),
),
);
$enterprise_posts = get_posts( $args );
在我的meta字段中,在\\u页上的键为enterprise\\u我存储了一个数组()之前类似的
update_post_meta( $post_id, \'enterprise_on_page\', array(\'trainees\', \'staff\') );
.<如果我打电话var_dump(get_post_meta($post->ID))
我得到以下输出:\'enterprise_on_page\' =>
array (size=1)
0 => string \'a:2:{i:0;s:8:"trainees";i:1;s:7:"staff";}\'
我如何修改我的查询以便只发布具有元值的帖子trainees
如图所示。到现在为止,我没有收到任何帖子。