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 ha two main parts, the first one is a sidebar and the second one is the main container. The sidebar is the main navigation of WP admin panel, 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 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

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

Conclusion

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

Enjoy Coding 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *