You can check if is_admin
or not in the first line of the function
add_filter('posts_where', 'advanced_search_query' );
function advanced_search_query( $where )
{
if(is_admin()){
return $where;
}
if( is_search() ) {
global $wpdb;
$query = get_search_query();
$query = like_escape( $query );
// include postmeta in search
$where .=" OR {$wpdb->posts}.ID IN (SELECT {$wpdb->postmeta}.post_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->postmeta}.meta_key = 'bible_reference' AND {$wpdb->postmeta}.meta_value LIKE '%$query%' AND {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id)";
// include taxonomy in search
$where .=" OR {$wpdb->posts}.ID IN (SELECT {$wpdb->posts}.ID FROM {$wpdb->posts},{$wpdb->term_relationships},{$wpdb->terms} WHERE {$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id AND {$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->terms}.term_id AND {$wpdb->terms}.name LIKE '%$query%')";
if(WP_DEBUG)var_dump($where);
}
return $where;
}