Skip Navigation

[Resuelto] Include "Pending Review" or "Draft" posts inside of Toolset View

This support ticket is created hace 2 años, 7 meses. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 2 respuestas, has 2 mensajes.

Last updated by susanT-4 hace 2 años, 7 meses.

Autor
Mensajes
#2150861

How do I include "Pending Review" or "Draft" posts inside of a Toolset View?

I have a toolset form creating a post. That post goes to "pending review" (could be draft if that makes it easier) after form submission. From the user's page, there is a toolset view that shows their posts.

The problem is, after they submit a post, then until that post is published, it is "gone" from the front end. I would like to be able to either add a section to their page that shows posts that are pending review, or include them in the same view as published posts (maybe with a status that says pending or something)

#2151153

Nigel
Supporter

Languages: Inglés (English ) Español (Español )

Timezone: Europe/London (GMT+00:00)

You can use the Views API to modify the query so that it includes posts with the status pending in the results (or draft, or both).

You'll need to add code such as the following, which you can do at Toolset > Settings > Custom Code.

function ts_filter_query( $query_args, $view_settings, $view_id ){

    if ( $view_id == '123' )
    {
        $query_args['post_status'][] = 'pending';
    }
    
    return $query_args;
}
add_filter( 'wpv_filter_query', 'ts_filter_query', 101, 3 );

Edit the ID of the View where you want to include pending posts in the results.

#2154097

Worked a treat. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.