admin管理员组文章数量:1287569
I have a custom post type "issues".
I am using Advanced Custom Fields to add a relational field called "articles_from_this_issue" where the admin can select multiple articles.
I have an author template where I display all of the authors posts (articles).
I need to query the "issues" custom post type and check to see if each article is one of the selected "articles_from_this_issue"
here is what I have tried so far but nothing seems to work.
$issues_args = array(
'post_type' => 'issues',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'articles_from_this_issue',
'value' => serialize( intval(get_the_ID()) ),
'compare' => 'LIKE'
),
));
$the_issues_query = new WP_Query( $issues_args );
I have also tried this:
$issues_args = array(
'post_type' => 'issues',
'meta_query' => array(
array(
'key' => 'articles_from_this_issue',
'compare' => 'LIKE',
'value' => get_the_ID(),
),
));
Here is what the database shows in the "wp_postmeta" table:
meta_id: 27533
post_id: 733
meta_key: articles_from_this_issue
meta_value: a:2:{i:0;s:4:"3187";i:1;s:4:"3230";}
Any and all help is much appreciated!
本文标签: phpQuery custom post type that has a serialized relational advanced custom field value
版权声明:本文标题:php - Query custom post type that has a serialized relational advanced custom field value 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741312861a2371748.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论