Duplicate user search log entries
-
We have built a page at search.php that uses a custom WP_Query, with relevanssi set to true.
Setup below:
global $wp_query;
global $query_string;
$query_args = explode("&", $query_string);
$search_query = array();
// Get ?s= term
if($query_args[0]) {
foreach($query_args as $key => $string) {
$query_split = explode("=", $string);
$search_query[$query_split[0]] = $query_split[1];
}
}
// URL urldecode term to allow spaces
if(!empty($search_query['s'])) {
$search_query['s'] = urldecode($search_query['s']);
}
// Disable pagination for now
$search_query['nopaging'] = true;
// use Relevanssi plugin for search
$search_query['relevanssi'] = true;
// Post types
$search_post_types = array('projects', 'post', 'people', 'research', 'event');
$search_query['post_type'] = $search_post_types;
$search = new WP_Query($search_query);
$total_results = $search->post_count;We then loop over
$searchand it all seems to work fine, but it also seems like the query is being fired twice.Every time we test a search entry, it is logged twice in the user search admin area. Screenshots attached at the end.
How can we make it so the query only submits once from this default search page.
Cheers.
J
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.