Add a dashboard link in WordPress

As an admin, your job is to create the best working environment for your authors. That includes customizing WordPress and creating a unique virtual workstation. We already taught you how to add any RSS to the dashboard. Another idea you can easily implement is adding links which can be used as bookmarks right on your dashboard.

If there are pages which you open on a regular basis when you work on your WordPress powered website, wouldn’t it be great to have them bookmarked on the dashboard? Yes, it might be a good idea to have all authors bookmark those websites in their own browsers but placing the most important links on the dashboard makes them available for everyone. There won’t be excuses that the links have been lost or that you have forgotten to bookmark them in your new browser.

It is easy to start adding bookmarks. Follow these simple steps and you’ll be done in minutes.

Add a dashboard link:

  1. Open functions.php
  2. Copy and paste the code:
  3. function linkedPage(){
    if(!current_user_can('manage_options')){
    wp_die( __('You do not have sufficient permissions to access this page.'));
    }
    ?>
    <script type="text/javascript">
    window.open("YOUR-URL");
    </script>
    <? }
    function dashboardMenu(){
    if(function_exists('add_submenu_page'))
    add_submenu_page('index.php', __(LINK-NAME), __(LINK-NAME), 'manage_options', 'stats', 'linkedPage');
    }
    add_action('admin_menu', 'dashboardMenu');
    
  4. Save changes
  5. After you have copied the code, there are only few thing you need to change in order to customize the link.

  6. Change the link URL on line #7
  7. For example:

    window.open("http://www.google.com");
  8. Name your link on line #12:

Change “LINK-NAME” in the brackets to anything you want. In the same example, you would probably want your link to be named “Google”:

add_submenu_page('index.php', __(Google), __(Google), 'manage_options', 'stats', 'linkedPage');

That’s all. After you save the changes again, a new link will appear on your Dashboard menu. After you click the link, a new tab will open and show the page you have specified in the code. Easy as that.

Add additional links t the dashboard:

If you want to add more than one dashboard link, follow these steps:

      1. Copy the first function linkedPage
      2. Paste it into the first function and rename it, for example, linkedPage2
      3. Change the URL to the new function
      4. Locate the add_submenu_page in the second function and copy the entire row
      5. Copy and paste the row underneath the first one
      6. Change the name of the link as shown above
      7. At the end of that line, find ‘linkedPage’ and change that to name of your new function (in our example that would be ‘linkedPage2’
      8. Save changes

Enjoy your new bookmarks on your WordPress dashboard. We hope you like this little WP “trick”. Since you’re already customizing the dashboard, see how to completely remove the welcome panel.

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

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