I'm working on a project where editors need to see the pending posts on the homepage to improve them before publish.

Maybe there is something to do with the loop in this way:

If editors logged:

if ( current_user_can('edit_post') ) {
    display the pending posts

The args to display publish and pending posts:

$args = array( 'post_type' => 'post', 'post_status' => 'publish, pending' );

The completed loop:

if ( current_user_can('edit_post') ) {
    $args = array( 'post_type' => 'post', 'post_status' => 'publish, pending' );
} else {
    $args = array( 'post_type' => 'post', 'post_status' => 'publish' );
$wp_query = new WP_Query($args); while ( have_posts() ) : the_post(); ?>

…the content here...

<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>

It work for me.

Do you think this is correct?

Maybe the code can be improved.

Thanks for the help.

1 Answer 1


I would filter pre_get_posts.

function allow_pending_posts_wpse_103938($qry) {
  if (!is_admin() && current_user_can('edit_posts')) {
    $qry->set('post_status', array('publish','pending'));

That should show pending posts to your editors for all of your queries on the front end. You can, of course, restrict is more if you'd like.

I'd add some code to mark the pending posts so your editors know at a glance what is pending.

  • 1
    I reiterate, that will effect all queries on the front end. Be aware.
    – s_ha_dum
    Jun 23, 2013 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.