[Plugin: Relevanssi – A Better Search] Maybe an optimization ?
-
Hello,
the function
relevanssi_query()
is launched when the filterthe_posts
is fired. This function retrieves the posts we are looking for, but, the WP_Query has already been launched and results analysed in&get_posts()
by WordPress.Is it possible to add the following filter on
pre_get_posts
:add_filter('pre_get_posts', 'cancel_wp_query', 10, 1); function cancel_wp_query($q) { if( $q->is_search ) { $q->query_vars['p'] = -1; } }
We specify to the query to find no post to optimize the loading time. Is it a bad idea ?
Thank you
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘[Plugin: Relevanssi – A Better Search] Maybe an optimization ?’ is closed to new replies.