Home » WordPress » How to add custom links to WordPress admin menu to ease website administration

How to add custom links to WordPress admin menu to ease website administration

WordPress may look super simple to use. At least to those who are already familiar with it’s interface. Give it to a person who has never administrated any website, and it will become a huge stress to them.

To make things easier for my WordPress customers I try to remove everything what’s not necessary for them in WordPress admin panel, and add shortcuts to pages which may be useful for them everyday.

Today I’ll show you a simple example how to add a link, or a group of links to WordPress admin panel.

How to add link to WordPress admin menu

In ths example I want to add link to posts which are filtered by specific WordPress category.

For example I have a post category in WordPress named Tips & Tricks, and I want to add link only to this posts in WordPress admin menu. To do so, first you need to get link to the filtered posts page.

Go to Posts >> All posts in WordPress admin menu, select post filter to Category > Tips & Tricks, and hit Filter button.

Now you’ll see posts filtered by category you want. To get the link for shortcut, copy current website URL starting with edit.php… Like that:

wordpress get filter link for shortcut

Once you have a link, go to Appearance >> Theme File Editor, or Tools >> Theme File Editor depending on the WordPress version and theme you use. Click Theme Functions file on the right, and add this code:

function add_link_to_category_tips_n_tricks() {
    $link = 'edit.php?s&post_status=all&post_type=post&action=-1&cat=3&filter_action=Filter&paged=1&action2=-1';
    add_menu_page( 'Tips & Tricks', 'Tips & Tricks', 'edit_pages', $link, '', 'dashicons-info-outline', 8 );
add_action( 'admin_menu', 'add_link_to_category_tips_n_tricks' );

Here’s what we are doing here:

  1. Add custom function to admin menu – in this case it’s named add_link_to_category_tips_n_tricks but you can call it any name you want.
  2. Then define $link – it’s the shortcut you want your admin menu link go to.
  3. Add the actual menu page with WordPress function add_menu_page. Add it’s name (‘Tips & Tricks’), set who can access this menu link (the same editors who can ‘edit_pages’), add the actual link, add dashicons icon, and add position where the custom menu item needs to show up. In this example it’s 8 – just under the Posts. But you may use higher numbers to show custom menu in the exact place you’d like it to be.

Best WordPress hosting 2024

That’s how it look in it’s place:

how to add link to wordpress admin menu

It may look complicated, but if you’ll look at the add_menu_page function documentation here, you’ll see every parameter you might need. Otherwise just copy my code, replace the link, add a new link title, and your custom link in WordPress admin menu is ready to use.

To use different icon for menu item, look at the default WordPress icons – Dashicons. Select any you want, and replace dashicons code with the one which suits your menu link best.

How to add group of links to WordPress admin menu

Imagine that you want to add few related links to WordPress admin menu. Like all the social network links of your business. Like this example:

add group of links to wordpress admin menu

Here is a working example you can add to functions.php file – to the same place you added code when crearting a single shortcut in WordPress admin:

function add_socials_admin_menu() {
    add_menu_page('Social Networks', 'Social Networks', 'edit_pages', 'my-social-links', '', 'dashicons-admin-site', 9 );
	add_submenu_page( 'my-social-links', 'Facebook', 'Facebook',
		'edit_pages', 'https://facebook.com/myfacebook');
	add_submenu_page( 'my-social-links', 'Twitter', 'Twitter',
		'edit_pages', 'https://twitter.com/mytwitter');
	remove_submenu_page('my-social-links', 'my-social-links');
add_action( 'admin_menu', 'add_socials_admin_menu' );

How it works:

  1. Add action to admin menu which will run function add_socials_admin_menu. You may rename function.
  2. Then in the function add main menu item. In this example it’s named Social Networks, and has a slug my-social-links. You”ll need this slug in few seconds.
  3. Add submenu items to Social Networks. Every item needs to be related with previously mentioned slug (my-social-link), so WordPress will know that the link belongs to Social Networks.
  4. You may notice remove_submenu_page function. By default first submenu item is the same as the main menu link. Since there in no need to repeat Social Networks link twice, we tell WordPress to remove that submenu link.

That’s it – now you have a custom group of links in WordPress admin menu.


Fathom analytics - privacy focused cookie-free website analytics

Most popular tutorials

Get our latest WordPress news and special offers from RockSolidWP!

Only useful WordPress and WooCommerce tips and tricks and exclusive offers for our readers once a month. No marketing nonsense.

Looking for reliable yet affordable WordPress hosting?
Hostinger is the way to go!

Get 10% OFF by using code IMAKEITWORK