Skip Navigation

[Resolved] Hide Default return values in an Ajax parametric search view

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

Our next available supporter will start replying to tickets in about 4.58 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)


This topic contains 1 reply, has 2 voices.

Last updated by Dat Hoang 8 years, 5 months ago.

Assigned support staff: Dat Hoang.


I am trying to:
I have created a parametric search view that selects a custom post type called resources, I have also creates a custom taxonomy called states for my resources post type.
In my view I have a select menu of states and when the user selects a different state it refreshes the view and displays the resources that belong to that state. All of this is working fine although I'm noticing when the page first loads the view pulls default resources into the view. I need a way not to show default resources when the page first loads and still make use of loading content into the same page.
I visited this URL:
hidden link
I expected to see:
No returned resources until a state is selected.
Instead, I got: default values.


Looks like you resolved the problem by yourself?

The link hidden link seems to work as your need.

If it does not work, please use the filter "wpv_filter_query" to ignore the page loading the results first.
The example code:

add_filter( 'wpv_filter_query', 'show_empty_default_func', 10, 2 );
function show_empty_default_func( $query_args, $setting ) {
    if($setting['view_id'] == 56 && !isset($_REQUEST['action']))
        $query_args['post__in'] = array(0);
    return $query_args;

Please change your searching view id, in my test, it's '56'.

The guide "wpv_filter_query":