# Drafts Link Under Every Post Type Menu

> Adds a "Drafts" submenu under Posts, Pages and each custom post type for one-click access to unfinished content.

- Type: PHP
- Runs: Admin only
- Category: [Admin](https://wpide.com/library/category/admin/)
- Tags: admin, menu, drafts
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/drafts-submenu-links/

## Code

```php
add_action( 'admin_menu', function () {
    foreach ( get_post_types( array( 'show_ui' => true, 'show_in_menu' => true ), 'objects' ) as $type ) {
        if ( 'attachment' === $type->name || true !== $type->show_in_menu ) {
            continue;
        }

        $parent = 'post' === $type->name ? 'edit.php' : 'edit.php?post_type=' . $type->name;

        add_submenu_page(
            $parent,
            'Drafts',
            'Drafts',
            $type->cap->edit_posts,
            'edit.php?post_type=' . $type->name . '&post_status=draft'
        );
    }
}, 20 );
```

## Notes

Post types that sit inside another plugin menu are skipped.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Drafts Link Under Every Post Type Menu" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
