How To

How to Add a New Custom Link in WordPress Sidebar

WordPress is quite famous for its flexibility and advancements. Even more, WordPress provides a friendly and powerful admin panel to manage the content on the website. Besides, WordPress supports further customization of the admin panel.

WordPress admin panel has two main parts, the first one is a sidebar and the second one is the main container. The sidebar is the WP admin panel’s main navigation, and it lists all the available functionalities, including plugins, themes, settings, etc.

What if we want to add a new link to the sidebar? The answer and its implementation both are quite simple and easy to implement.

Add New External Link to WP-Admin Sidebar

To add a custom link to your wp-admin sidebar, follow the below steps.

First, open wp-admin and go to the theme editor.

After that, copy and paste the below code in the functions.php file of the active WordPress theme.

Read Also: Custom Session in WordPress

CODE

add_action( 'admin_menu', 'linked_url' );
function linked_url() {
  add_menu_page( 'linked_url', 'NEW LINK TITLE', 'read', 'my_slug', '', 'dashicons-list-view', 1 );
}

add_action( 'admin_menu' , 'linkedurl_function' );
function linkedurl_function() {
  global $menu;
  $menu[1][2] = "LINK";
}

Explanation

We added a new external link in the wp-admin sidebar in the above code at the first position.

Conclusion

I hope the above code will add a new external link to your wp-admin panel. WordPress provides much more advancements to help users with an effortless experience.

Enjoy Coding 🙂

Nachiket Panchal

Founder & Administrator of `errorsea` Having interest in Programming & Technology.

Recent Posts

5 Important Things To Know About WordPress Before You Use It

There is a reason big-name companies like CNN use WordPress. WordPress is a popular content…

3 years ago

How to Install MySQL on Your PC in 3 Easy Steps

In this tutorial, I'm going to show you how to install MySQL on your computer.…

4 years ago

Download and Install Turbo C++ for Windows 10 (Full Installation Guide)

Download Turbo C++ for windows 10 in just 7 Mb and run your first C++…

5 years ago

PHP .HTACCESS Redirects

We can redirect any webpage to any other or redirect the whole domain or website…

5 years ago

PHP Redirect Pages

There are lots of methods to redirect pages, like refresh-redirect from META tag, redirect from…

5 years ago

PHP Include & Required

Include files in PHP are used in appending various global or config files. We can…

5 years ago