WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a submenu page for reordering posts/pages. Right now I'm trying to include the list that display the different post statuses, for example:

All (5) | Published (4) | Draft (1)

I was digging around in edit.php and found that it pulls the list like this:


Which lead me to class-wp-list-table.php where I found this:

function views() {
    $screen = get_current_screen();

    $views = $this->get_views();
    $views = apply_filters( 'views_' . $screen->id, $views );

    if ( empty( $views ) )

    echo "<ul class='subsubsub'>\n";
    foreach ( $views as $class => $view ) {
        $views[ $class ] = "\t<li class='$class'>$view";
    echo implode( " |</li>\n", $views ) . "</li>\n";
    echo "</ul>";

So, since it checks the current screen, would it be possible in someway to set my custom submenu item to "pose" as edit.php although it's not?

Or if there's some easier way to do this.

Thanks alot in advance

share|improve this question
up vote 2 down vote accepted

The class used in edit.php is an extension of the WP_List_Table: WP_Posts_List_Table. See wp-admin/includes/class-wp-posts-list-table.php.

And here you find a call to wp_count_posts( $type = 'post', $perm = '' ). The first parameter is for the post type, the second can be empty or readable. If it is readable and the current user has no permission to see private posts these posts will be excluded. That’s what WP_Posts_List_Table does in get_views().

If you call this function without any arguments on the front page you get something like this:

stdClass Object
    [publish] => 19
    [future] => 1
    [draft] => 6
    [pending] => 0
    [private] => 0
    [trash] => 8
    [auto-draft] => 42
    [inherit] => 0
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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