Add a "Quick links" menu to the admin bar with shortcuts to screens you open often, like Permalinks and Site Health.
add_action( 'admin_bar_menu', function ( WP_Admin_Bar $bar ): void {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
$bar->add_node( [ 'id' => 'nahnu-quick', 'title' => 'Quick links', 'href' => false ] );
$links = [
'Permalinks' => admin_url( 'options-permalink.php' ),
'Site Health' => admin_url( 'site-health.php' ),
'Menus' => admin_url( 'nav-menus.php' ),
'Plugins' => admin_url( 'plugins.php' ),
];
if ( class_exists( 'WooCommerce' ) ) {
$links['WooCommerce status'] = admin_url( 'admin.php?page=wc-status' );
}
foreach ( $links as $title => $href ) {
$bar->add_node( [
'parent' => 'nahnu-quick',
'id' => 'nahnu-quick-' . sanitize_title( $title ),
'title' => esc_html( $title ),
'href' => esc_url( $href ),
] );
}
}, 100 );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
If you keep opening the same few admin screens, a shortcut saves clicks. This snippet adds a “Quick links” dropdown to the admin bar, on the front end and in wp-admin.
On admin_bar_menu, the snippet adds a parent item, then a child item for each link. admin_url() builds the addresses so they work on any domain. A WooCommerce status link is added only when WooCommerce is active.
$links array to add your own, such as a plugin’s settings page.Hover over “Quick links” in the admin bar. The dropdown should list your shortcuts.