Hi David. Had tried that – no conflict. But I put the site on a MAMP and disabled everything. Turns out it was one function in my child theme. You don’t need to answer this, but I’m baffled.
This works OK
add_filter( 'pre_get_posts', 'custom_post_type_search' );
function custom_post_type_search( $query ) {
if ($query->is_search) {
$query->set('post_type', array( 'post', 'drlc_online', 'drlc_libraries', 'event'));
}
return $query;
}
But this breaks the menu:
function rc_add_cpts_to_search($query) {
if( is_search() ) {
$post_types = get_post_types(array('public' => true, 'exclude_from_search' => false), 'objects');
$searchable_types = array();
if( $post_types ) {
foreach( $post_types as $type) {
$searchable_types[] = $type->name;
}
}
$query->set( 'post_type', $searchable_types );
}
return $query;
}
add_action( 'pre_get_posts', 'rc_add_cpts_to_search' );
Any idea why? As I say, not your job to answer at all, just chancing the ask ๐
Mike