Search doesn’t return any results from CPTs
-
Hello.
I ve got similar issue with this one
https://www.ads-software.com/support/topic/finds-nothing-from-custom-fields/
I ve added all the post types and it only works with the page title not acf fields.All the acf fields are inside flexible and clone fields, if that helps.
Here is the code:
if ( $query->is_search() ) { $post_type = filter_input( INPUT_GET, 'post_type' ); $post_type = ! empty( $post_type ) ? $post_type : 'any'; $query->set( 'post_type', $post_type ); }
WP_Query Object ( [query] => Array ( [s] => We work with airports all over the world to help [post_type] => solution ) [query_vars] => Array ( [s] => We work with airports all over the world to help [post_type] => solution [error] =>
Thank you!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Search doesn’t return any results from CPTs’ is closed to new replies.