Skip Navigation

[Resolved] wpv_filter_query not working when AJAX is run

This support ticket is created 3 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by benjaminJ-3 3 years, 7 months ago.

Assisted by: Waqar.

Author
Posts
#2006597

Tell us what you are trying to do?
I don't want my wpv_filter_query to stop working when the AJAX results are triggered.

Is there any documentation that you are following?
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

Is there a similar example that we can see?
This works on load but not when AJAX filters are fired.
if ( $view_id == 690 ) {

if ( !is_admin() ) {
$query_args['author'] = empty( $current_user->ID ) ? -1 : '-'.$current_user->ID;
if ( !empty($raw_ids) ) {
$query_args['post__not_in'] = $ids;
}
}
}

What is the link to your site?
hidden link

#2007245

Hi,

Thank you for contacting us and I'd be happy to assist.

The custom function attached to the "wpv_filter_query" filter should be executed, when the results are updated through AJAX.

Can you please share temporary admin login details along with the complete function code that you're using with the "wpv_filter_query" filter?

This will help in troubleshooting this on a test website with a similar setup.

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#2010321

Thank you for sharing these details.

I've performed some tests on my website with a similar view and custom function and noticed that the "!is_admin()" check needs to be removed, in order to make the filtering work, when the results are updated through AJAX.

From your function "prefix_no_show_only_current_author", you'll only need to remove the "!is_admin()" check.

#2010847

My issue is resolved now. Thank you for your help with this!