Starting on line 474
of /wp-includes/admin-bar.php
there is a function that is declared as the following:
function wp_admin_bar_new_content_menu( $wp_admin_bar )
What it does it generates the + New
menu item along with any custom post types that a user has edit_posts
capability for. The actual top-menu item, + New
defaults to posts
since it is the first called in the array (I believe that's how it works). I'd like to actually change that first + New
link to something else. In our setup, we need to give users edit_posts
capability to manage Advanced Custom Fields Options pages, but are not giving them access to posts themselves (which we just had to hide from the menu system). A bit funky, but it's more of a usability concern for us.
Aside from all the jumble I said above, can you modify an existing menu link based on the ID of the item itself (which is new-content
in this case) or would I need to destroy and rebuild the menu itself? I'm just looking to change that href
attribute to #
. Thanks!
unset( $cpts['post'] );
to line 481, as getting rid of the option to add a post that way entrily was not an issue for me.