Problem:
How to include posts with a status of "Pending review" in the output of a View.
Solution:
By default a View will only list published or private posts. To include other statuses it is necessary to use the wpv_filter_query API filter to modify the query arguments.
An example of such code would be:
function ts_filter_query( $view_args, $view_settings, $view_id ) { if ( in_array( $view_id, array( 117 ) ) ) { // list of View IDs to apply this to $view_args['post_status'] = array( 'publish', 'pending' ); } return $view_args; } add_filter( 'wpv_filter_query', 'ts_filter_query', 101, 3 );
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
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 |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
This topic contains 2 replies, has 2 voices.
Last updated by 5 years, 3 months ago.
Assisted by: Nigel.