Skip Navigation

[Resolved] My custom wpv_filter_query filter isn't being called

This support ticket is created 4 years, 3 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by Minesh 4 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#2069631

Tell us what you are trying to do?
I'm trying to add a wpv_filter_query filter

Is there any documentation that you are following?
I've tried all of the recent examples of wpv_filter_query that I could find.

Is there a similar example that we can see?
See below.

What is the link to your site?
hidden link

I'm trying to hook into wpv_filter_query, but it's just not firing when the view is displayed.

Here is my code:

function theme_wpv_filter_query($query_args, $view_settings, $views_id) {

error_log(print_r($query_args, true));

switch ($views_id) {

case 3887:
die($query_args);
break;

default:
die($query_args);
break;
}

return $query_args;
}
add_filter( 'wpv_filter_query', 'theme_wpv_filter_query', 10, 3 );

On the front end, I'm display the view with the following shortcode:

{!{wpv-view name='orders-summary'}!}

When I load the Orders Summary page, the view is displayed as expected, but my wpv_filter_query hook isn't being fired because nothing is being written to the error log, and the page isn't die()ing.

Am I missing something obvious?

#2069909

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please tell me where you added the view's filter code as well as share admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2070045

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

When I try to access the wp-admin, it shows me the message "Too many redirects" and I do not able to access the admin.

Can you please resolve it and let me know.

#2070077

Sorry, please try without the wp-admin, it should redirect you there.

#2070177

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As you are using the taxonomy view, to filter the taxonomy view, you will require to use the filter: wpv_filter_taxonomy_query
=> https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_taxonomy_query

Toolset offers the "Custom Code" section, so I've moved the code to the "Custom Code" sectoin:
=> hidden link

I can see the view hook is called:
hidden link

#2072177

Thanks for the help Minesh. I wasn't actually able to use the wpv_filter_taxonomy_query for my exact use case, but it's given me some useful knowledge for the future.

#2072183

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok great - let me know if you have any other queries.