Skip Navigation

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

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.

This topic contains 2 replies, has 2 voices.

Last updated by susanT-4 1 year, 5 months ago.


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)



Languages: English (English ) Spanish (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.


Worked a treat. Thank you!