添加/删除WP管理栏链接
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了添加/删除WP管理栏链接相关的知识,希望对你有一定的参考价值。
Here are some IDs for the default links WP 3.1 adds, found in /wp-includes/admin-bar.php:my-account / my-account-with-avatar : the first link, to your account. Note that the ID here changes depending on if you have Avatars enabled or not.
my-blogs : the 'My Sites' menu if the user has more than one site
get-shortlink : provides a Shortlink to that page
edit : link to Edit [content-type]
new-content : the 'Add New' dropdown
comments : the 'Comments' dropdown
appearance : the 'Appearance' dropdown
updates : the 'Updates' dropdown
<?php function mytheme_admin_bar_render() { global $wp_admin_bar; // we can remove a menu item, like the COMMENTS link // just by knowing the right $id $wp_admin_bar->remove_menu('comments'); // we can add a submenu item too 'parent' => 'new-content', 'id' => 'new_media', 'title' => __('Media'), 'href' => admin_url( 'media-new.php') ) ); } // and we hook our function via add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' ); ?>
以上是关于添加/删除WP管理栏链接的主要内容,如果未能解决你的问题,请参考以下文章