[resolved] List pending Posts (1 post)

  1. Peter Vazquez
    Posted 3 years ago #

    I wanted to know how to list pending posts in the frontend, and i finally did it... but i wanted to share the code i have used in order to know if i am using a proper way to list pending posts.

    I don't know much about coding, so i copy codes and try if they work... until i get the final solution i found 2 ways of doing it:

    First is writing this code just before the start of the Loop in a custom page template:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'post_status' => 'pending',
    	'paged' => $paged

    Second is doing the same but with this code:

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

    Number 1 and 2 were not working fine.... but finally i found the third one :

    <?php query_posts('showposts=10&post_status=pending'); ?>

    And it works... you can watch it in action here.

    So, is the third one a proper solution?

    Many thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic