Skip Navigation

[Resolved] Query Filter check if Date was filled in or blank

This thread is resolved. Here is a description of the problem and solution.

Problem:

I am trying to use the Views Query filter to check if a Date field was filled in or is blank. What is the best way to check that using the options available in the Query Filter?

Solution:

I suggest you try Views filter hook wpv_filter_query, for example, when user submit the search form, use wpv_filter_query to trigger a PHP function, in this function check the "Date field was filled in or is blank", then do what you want.

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_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 2 replies, has 2 voices.

Last updated by Mukesh 5 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#1192316

I am trying to:
I am trying to use the Views Query filter to check if a Date field was filled in or is blank. What is the best way to check that using the options available in the Query Filter?
:

#1192329

Hello,

I suggest you try Views filter hook wpv_filter_query, for example, when user submit the search form, use wpv_filter_query to trigger a PHP function, in this function check the "Date field was filled in or is blank", then do what you want.

See our document:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

You can get the example codes by clicking link "Usage examples"

#1192366

My issue is resolved now. Thank you!