Home › Forums › General Issues › Post Object field: Search not returning result for media/attachment › Reply To: Post Object field: Search not returning result for media/attachment
Ok, found the problem. Had some code inside functions.php (from a previous project) messing with the search query..
// Extend search to include pages and posts
function wp_search_filter( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', array('post','page') );
}
return $query;
}
add_filter('pre_get_posts','wp_search_filter');
Removed it, and now everything is working as expected! Happy times! 😀
Thanks again James for pointing me in the right direction. Cheers!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.