Add “external” link to admin menu in the backend

Trying to add a link to my admin menu (dashboard/backend) that leads to the frontend of wordpress, so I basically want a link in the menu that takes me to the blog.

I’ve found a couple of ways to add new stuff to the admin menu, but I haven’t been able to link to the home_url, it seems like the admin menu only is designed to let you link to stuff within the wp-admin. Anyone that have succeeded with this?

Edit:
Tried with this: https://gist.github.com/792b7aa5b695d1092520

add_admin_menu_item('Overview',array( 
      'title' => 'View Site',
      'slug' => get_bloginfo('url')
  ));

Which gives me the link hxxp://myurl.com/myurl.com
With this plugin (hxxp://wordpress.org/extend/plugins/admin-menu-editor/), I get:
hxxp://myurl.com/wp-admin/www.test.com

5 s
5

you can create a function that redirects to the front-end
like this:

function redirect_home_987(){
  wp_redirect( home_url() ); 
  exit;
}

and call that function in WordPress default add_menu_page function like this:

add_menu_page( 'redirecting', 'View Site', 'read', 'my-top-level-handle', 'redirect_home_987');

Hope this helps

Leave a Comment