I'm modifying the search query:
add_filter('posts_join', 'myfunctionjoin' )
add_filter( 'posts_where','myfunctionwhere' )
These functions slow down the search response a bit , so I would like to "activate" them only if search term doesn't match a specific condition. I'm able to achieve that by referencing to $_GET['s']
:
if ($_GET["s"] != 'something'){
add_filter('posts_join', 'myfunctionjoin' )
add_filter( 'posts_where','myfunctionwhere' )
}
but I would feel more safe to use the WordPress 'search term'. I did try:
if ($wp_query->query_vars['s'] != 'something'){
add_filter('posts_join', 'myfunctionjoin' )
add_filter( 'posts_where','myfunctionwhere' )
}
but no success... How do I put the WordPress 'search term' in a condition to activate the filters?