Add Menu Items to the WordPress Admin?Menu
Read the full article at: Add Menu Items to the WordPress AdminMenu The existing menus in WordPress are solid but one annoyance is that I need to click All Posts and then the Drafts link to get to my drafts; I simply want to get there as q
Read the full article at: Add Menu Items to the WordPress Admin Menu
The existing menus in WordPress are solid but one annoyance is that I need to click “All Posts” and then the “Drafts” link to get to my drafts; I simply want to get there as quickly as possible via the Posts menu. I did some quick research on the topic and in two minutes I was able to add a “Drafts” submenu item to the “Posts” menu. Here’s how I did it!
Within the functions.php file of my current theme (this file gets loaded even for admin!), I added the following:
// Add menu item for draft posts function add_drafts_admin_menu_item() { // $page_title, $menu_title, $capability, $menu_slug, $callback_function add_posts_page(__('Drafts'), __('Drafts'), 'read', '?post_status=draft&post_type=post'); } add_action('admin_menu', 'add_drafts_admin_menu_item');
The add_posts_page
method is actually a shortcut for add_submenu_page
, which allows you to add a submenu item for any existing menu item. And WordPress allows you to get pretty detailed with your own menus, as you can see here.
This added “Drafts” link will save me click after click after click throughout my time using WordPress. Take the few moments to add links to existing menus as you’d like — there’s nothing like a fresh shortcut to get you moving faster!
Related Posts
- Create a “Recent Posts” Module Outside of WordPress
- Create a Context Menu with Dojo and Dijit
- Prevent Posts in a Category From Displaying in WordPress’ Loop
- Prevent Posts in a Category From Displaying in WordPress’ RSS Feed
- Disable WordPress autop
下一篇: php基础编程常见有关问题汇总
推荐阅读
-
wordpress 里面怎么只获取菜单的名称和链接? wp_nav_menu会把样式取出
-
wordpress 里面怎么只获取菜单的名称和链接? wp_nav_menu会把样式取出
-
Add Menu Items to the WordPress Admin?Menu
-
Add a Submenu to the WordPress Admin Bar
-
Add a Submenu to the WordPress Admin Bar
-
Delphi Open Tools API - How to create and add new menu item
-
wordpress 里面如何只获取菜单的名称和链接? wp_nav_menu会把样式取出.
-
wordpress 里面如何只获取菜单的名称和链接? wp_nav_menu会把样式取出.
-
Add Menu Items to the WordPress Admin?Menu