asp_query_args Not Firing in AJAX Search Lite
-
Hi,
I’m trying to modify the search query using the
asp_query_args
filter, but it doesn’t seem to fire at all. I’ve addederror_log('ASP Query Hook Triggered!');
, but nothing appears indebug.log
.Here’s my code:
function wpsp_orderby_posts($vars) {
$params = wpsp_get_orderby_select();
if ( !is_admin() && $vars->is_main_query() ) {
$vars->set('meta_key', $params['meta_key']);
$vars->set('orderby', $params['orderby']);
$vars->set('order', $params['order']);
$vars->set('ignore_sticky_posts', 1);
return $vars;
}
}
add_filter('pre_get_posts', 'wpsp_orderby_posts');Could you confirm if this hook is still working, or suggest an alternative way to sort results by a custom field?
Thanks!
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- You must be logged in to reply to this topic.