WP Static Pages and Sites Link
With the newer versions of WordPress the admin nav bar is great. But when you have a static page site for home and blog, then the site link always brings you to the home page, when most of the time you want the blog page.
This snippet will add a Blog link to the Admin Nav Bar when in the Admin area.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
function add_blog_menu() { /** @var $wp_admin_bar WP_Admin_Bar */ global $wp_admin_bar; if (!is_super_admin() || !is_admin_bar_showing()) return; if (is_admin()) { $wp_admin_bar->add_menu(array( 'id' => 'blog', 'title' => 'Blog', 'href' => site_url() . '/blog' ) ); } } add_action('wp_before_admin_bar_render', 'add_blog_menu'); |
Note: the Blog link.
This alows you to quickly return the sites blog from the admin panel when having a static home page that is not the blog or post list.