Passer la navigation

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

This support ticket is created Il y a 3 weeks, 4 days. 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 -

Fuseau horaire du supporter : Asia/Kolkata (GMT+05:30)

Ce sujet contient 2 réponses, a 1 voix.

Dernière mise à jour par ABSTRACTUS Il y a 3 weeks, 3 days.

Assisté par: Minesh.

Auteur
Publications
#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

Les langues: Anglais (English )

Fuseau horaire: 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

Les langues: Anglais (English )

Fuseau horaire: 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":
=> lien caché

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:
- lien caché

#2858484

Thank you, yes now it is behaving as expected.

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