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

1 Answer 1


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

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.