Admin & Dashboard PHP Beginner

Reorder the Admin Menu

Put the wp-admin menu items in the order your team uses most, such as Pages above Posts.

Tested on WordPress 7.1 PHP 8.3 No plugin needed Updated
functions.php 20 lines
add_filter( 'custom_menu_order', '__return_true' );

add_filter( 'menu_order', function (): array {
	return [
		'index.php',                        // Dashboard.
		'separator1',
		'edit.php?post_type=page',          // Pages.
		'edit.php',                         // Posts.
		'upload.php',                       // Media.
		'woocommerce',                      // WooCommerce.
		'edit.php?post_type=product',       // Products.
		'separator2',
		'themes.php',                       // Appearance.
		'plugins.php',                      // Plugins.
		'users.php',                        // Users.
		'tools.php',                        // Tools.
		'options-general.php',              // Settings.
		'separator-last',
	];
} );

Where to add this

Recommended A code snippets plugin Survives theme changes and is easy to switch off.
Child theme At the end of your child theme's functions.php file.
Must-use plugin As a .php file in wp-content/mu-plugins, starting with <?php.

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.

On brochure sites, Pages matter more than Posts. On stores, WooCommerce and Products are what people open every day. This snippet puts the admin menu in the order you choose.

How it works

Returning true from custom_menu_order tells WordPress to apply menu_order. That filter returns the menu items, by their file names or slugs, in the order you want them. Items you don’t list keep their position after the listed ones, so plugin menus never disappear.

Things to watch

  • Separators are the thin gaps between groups: separator1, separator2 and separator-last.
  • To find a plugin’s menu slug, hover over its menu item and look at the link: it’s the page= value, or the file name for top-level items.

How to test it

Reload wp-admin. Pages should appear above Posts.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only