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
you can create a function that redirects to the front-end
like this:
and call that function in WordPress default add_menu_page function like this:
Hope this helps
The name of site (top left, next to WP logo) links to front-end, is that not sufficient?
Also it would help if you included code that you had tried so far in the question.
You cannot add items to the admin menus that point to external URLs, the menu addition functions do not support this, nor will they allow it.
However, if you attach a callback onto the
admin_menu
hook, you can insert some items yourself manually and totally overcome the non-external URL problem. I do this myself and i’m quite surprised noone has already pointed out the issue with external menu links.I provided an example when answering Adding an Arbitrary Link to the Admin Menu?
Let me know if that helps.
just add ../ as slug prefix: