relevanssi_do_query in Ajax hook
-
Hi,
I’m building a Relevanssi integration extension for my plugin Ajax Load More but I cannot getrelevanssi_do_query($query)
to work in my the Ajax filter.From Ajax Load More I dispatch a call to a
custom alm_relevanssi_get_posts()
filter to return some post IDs to Ajax Load More, howeverrelevanssi_do_query($query)
always returns empty when used in the Ajax call.Here is the filter.
function alm_relevanssi_get_posts($args){ if(function_exists('relevanssi_do_query')){ $query = new WP_Query($args); relevanssi_do_query($query); if ( $query->have_posts() ) { $the_posts = ''; while ( $query->have_posts() ) { $query->the_post(); echo $post->ID; $the_posts[] = $post->ID; } $args['post__in'] = $the_posts; $args['orderby'] = 'post__in'; // override orderby to relevance $args['s'] = ''; // Reset 's' term value } return $args; } }
FYI – I can confirm relevanssi_do_query($query) works correctly in my standard search template, it’s just failing when being called with Ajax.
Hope this make sense to you…. Any ideas?
Cheers,
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘relevanssi_do_query in Ajax hook’ is closed to new replies.