# Shortcut Buttons Dashboard Widget

> Puts big buttons for the most common tasks, like writing a post or editing menus, at the top of the dashboard. Ideal for clients.

- Type: PHP
- Runs: Admin only
- Category: [Dashboard](https://wpide.com/library/category/dashboard/)
- Tags: dashboard, widget, client
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/shortcut-buttons-dashboard-widget/

## Code

```php
// Label => array( admin path, capability needed ).
$wpide_dashboard_shortcuts = array(
    'Write a post' => array( 'post-new.php', 'edit_posts' ),
    'Add a page'   => array( 'post-new.php?post_type=page', 'edit_pages' ),
    'Media'        => array( 'upload.php', 'upload_files' ),
    'Menus'        => array( 'nav-menus.php', 'edit_theme_options' ),
    'Comments'     => array( 'edit-comments.php', 'moderate_comments' ),
);

add_action( 'wp_dashboard_setup', function () use ( $wpide_dashboard_shortcuts ) {
    wp_add_dashboard_widget( 'wpide_shortcuts', 'Shortcuts', function () use ( $wpide_dashboard_shortcuts ) {
        echo '<div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:8px">';
        foreach ( $wpide_dashboard_shortcuts as $label => $shortcut ) {
            if ( ! current_user_can( $shortcut[1] ) ) {
                continue;
            }
            printf(
                '<a class="button button-hero" style="text-align:center;white-space:normal" href="%s">%s</a>',
                esc_url( admin_url( $shortcut[0] ) ),
                esc_html( $label )
            );
        }
        echo '</div>';
    } );
} );
```

## Notes

Menus only exist in classic themes; use site-editor.php?path=/navigation for block themes.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Shortcut Buttons Dashboard Widget" 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/
