List All Post Types in Admin view using /wp-admin/edit.php?post_type=

I have successfully created a custom post type. I’m trying to construct a URL which points to a combined listing of posts of all post types on the view all posts page in the admin view.

I can construct a URL which points to posts of specific post types, eg
http://<mysite>//wp-admin/edit.php?post_type=my_post_type. But I can’t find a way of listing posts of all post types.

Is it possible to use the /wp-admin/edit.php?post_type= slug to point to a page listing posts of all post types? Or, how else can I build a URL which will?

Solutions Collecting From Web of "List All Post Types in Admin view using /wp-admin/edit.php?post_type="

The only way this could work would be ?post_type=any based on WP_Query post_type params.

But the context is the problem, the edit.php page requires a specific post type, to display and edit only one $post_type_object which returns, for each post_type, only one singular label, one plural label and so many others individual properties.

These are not only technical blocking problems but also conceptual ones which make this impossible to be done.

Personally, I would research on “How to build a custom admin page” with a query like post_type=any

You could use pre_get_posts with a $_GET parameter and piggyback on the current post type – for example, say we’re viewing all editable posts in the admin panel, we can add a parameter showall=true and show all post types:

/**
 * Show all post editable post types
 *
 * @param WP_Query Object $query
 *
 * @return void
 */
function show_all_posttypes( $query ) {
    if( ! is_admin() ) {
        return;
    }

    if( isset( $_GET, $_GET['showall'] ) && true == $_GET['showall'] ) {
        $query->set( 'post_type', 'any' );
    }
}
add_filter( 'pre_get_posts', 'show_all_posttypes' );

If you want to limit the post types by some way or another you can use get_post_types() function and pass the returned post types into the post_type parameter as an array().

We can even add this as a subpage admin link for ease of access:

/**
 * Show All Post Types Link
 * - Subpage of "All Pages"
 *
 * @return void
 */
function show_all_posttypes_link() {
    add_submenu_page('edit.php?post_type=page', '', 'All Post Types', 'edit_posts', '/edit.php?post_type=page&showall=true');
}
add_action( 'admin_menu', 'show_all_posttypes_link' );

You could keep extending this on and on to customize the column outputs and such but this is the gist of it.