Archived topic
Link to post in the dashboard
5 replies · Started by Oliver on June 3, 2021
I created a post which I published as private not public and named it To Do. I would like to somehow create a link in the dashboard (what you see right away after login in) that takes you to that post. I wouldn´t want to use a plugin for this and would rather the link to be created with php, added through the Code Snippet plugin.
Hi there,
try the method provided here:
https://wpsites.net/wordpress-admin/add-top-level-custom-admin-menu-link-in-dashboard-to-any-url/
I copied this:
add_action( 'admin_menu', 'register_custom_menu_link' );
function register_custom_menu_link(){
add_menu_page( 'custom menu link', 'Your Menu Link', 'manage_options', 'any-url', 'wpsites_custom_menu_link', 'dashicons-external', 3 );
}
function wpsites_custom_menu_link(){
wp_redirect( 'http://12XX.X.X.X/wordpress/ToDo', 301 );
exit;
}
And I now have a new entry in the dashboard menu that leads nowhere (http://1XX.X.X.X/wordpress/wp-admin/admin.php?page=any-url)
I can´t show you much as I am creating the site offline as you probably guessed.
I was actually referring to creating a normal link to the To Do post inside the dashboard boxes (like the site health status, quick draft, at a glance etc...)
I know I made it sound as if I know what I´m doing, but I actually don´t know much.
Perhaps this would help:
https://developer.wordpress.org/reference/functions/add_menu_page/
Thanks guys!
Have a nice day.
No problem :)