admin管理员组文章数量:1424993
In need of some help. I have my search results showing the custom post type with all the ACF fields inside. What I want is the search result to show the ACF singularly with a field name of file_name that is a text field and file field file_pdf. together they would be one result from any given amount of posts from the user. I can't seem to understand the way to code this. I'm currently using relevanssi plugin. I'm struggling with the idea of filtering just those two fields to show in the results.
function wpb_search_filter($query)
{
global $current_user;
if ($query->is_search && !is_admin())
$query->set('author', $current_user->ID);
// $query->set( 'post_type', array( 'pricing', 'attachment' ) );
$query->set('meta_query', array(
'key' => 'file_pdf',
'value' => $query->query['s']
));
return $query;
}
add_filter('pre_get_posts', 'wpb_search_filter');
本文标签: search results to show individual ACF fields from inside custom posts
版权声明:本文标题:search results to show individual ACF fields from inside custom posts 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745404874a2657206.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论