Skip Navigation

[Resolved] Is it possible to get the PHP query behind a content view query?

This support ticket is created 5 years, 11 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
- 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/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 5 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#1180382

Tell us what you are trying to do?
I need to build a range of queries, some of which are quite complex with filtering. I do however need more flexability to use the query results outside of the views.

#1180591

Hello,

Views plugin is using WordPress class WP_query to query posts, so you can follow WordPress document to setup your own complex query manually:
https://codex.wordpress.org/Class_Reference/WP_Query

You can also use Views plugin to query posts, and customize filters to view by using API hook "wpv_filter_query", see our document:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
When displaying a View listing posts, this filter is applied to the arguments being generated by the View settings before they are passed to the WP_Query class.

#1180705

Hi Luo,

Thank you for getting back to me.

I'm aware that I could manually create the query and filters or create them within toolset views. What I meant is, is it possible to view the WP_Query of a view created within toolset?

Thanks
Ben

#1180709

Dear Ben,

Yes, you can try this:
Dashboard-> Toolset-> Settings-> Front-end Content,

in section "Debug mode", enable options:
- Enable Views debug mode
- Full debug mode

Then test your view in front-end, it should be able to popup a debug window, there you can get the WP_Query parameters