Skip Navigation

[Resolved] View Filter is set for “status of publish” but also displays “pending” posts

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 2 replies, has 1 voice.

Last updated by ABSTRACTUS 3 days, 1 hour ago.

Assisted by: Minesh.

Author
Posts
#2858432
Bildschirmfoto 2026-04-27 um 09.08.47.png

I want to create a view that lists only published posts.

I have set the Query Filters:
Post status filter
Select posts with status of publish.

but in the view also posts with status "pending review" are displayed.
View Caching is off.

What setting am I overlooking to get the pending posts really filtered out?

#2858453

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

That is really strange.

Can you please share problem URL where you added your view as well as admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) 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.

#2858483

Minesh
Supporter

Languages: English (English )

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

The issue was - you have added the following code to "Custom Code" section offered by Toolset with the code snippet "display-pending":
=> hidden link

function ts_filter_query( $query_args, $view_settings, $view_id ){
 
    if ( $view_id == '867' or '879' or  '881' )
    {
        $query_args['post_status'][] = 'pending';
    }
     
    return $query_args;
}
add_filter( 'wpv_filter_query', 'ts_filter_query', 101, 3 );

I found the above code is added incorrectly. I've corrected it as given under and saved the code snippet:

function ts_filter_query( $query_args, $view_settings, $view_id ){
 
    if ( $view_id == '867' or $view_id =='879' or $view_id =='881' )
    {
        $query_args['post_status'][] = 'pending';
    }
     
    return $query_args;
}
add_filter( 'wpv_filter_query', 'ts_filter_query', 101, 3 );

Can you please check now and confirm it works as expected:
- hidden link

#2858484

Thank you, yes now it is behaving as expected.

I must admit that I wasn't aware of such added snippets code 😳