How to Add a Link to the Drop-Down User Menu in the Admin Bar?

You want to use $wp_admin_bar->add_node( $args ). Below is a tested working example. function wpse_add_toolbar_edit($wp_admin_bar) { $wp_admin_bar->add_node( array( ‘id’ => ‘mylink’, ‘title’ => ‘My New Link’, ‘href’ => ‘mailto:[email protected]’, ‘parent’ => ‘user-actions’ ) ); } add_action(‘admin_bar_menu’, ‘wpse_add_toolbar_edit’, 999); Note: The parent param adds the link to an existing ID. If you need to find the … Read more

How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?

The problem is that when the special subscriber tries to Add New a sub-cpt post, it is denied permission. However, when the CPT menu is a top-admin-menu, then everything works out fine. The issue is related to the placement of the CPT’s UI menu in the back-end: if it’s top-level (show_in_menu=TRUE), all is well; if … Read more

Rename W3 Total Cache admin menu

You may be able to use the WordPress filter ‘gettext’: http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext add_filter( ‘gettext’, ‘rename_menu_item’ ); function rename_menu_item( $translated ) { $translated = str_replace( ‘Performance’, ‘Ytelse’, $translated ); return $translated; }

Removing WordPress Plugin Menu Item for a specific user

Here is the code you need: global $current_user; get_currentuserinfo(); if ( $current_user->user_login === ‘brian’ ) remove_action( ‘admin_menu’, ‘wpcf7_admin_menu’, 9 ); Or if you want to retain your own code, use this: function remove_menus() { global $menu; global $current_user; get_currentuserinfo(); if($current_user->user_login == ‘brian’) { $restricted = array(__(‘Media’), __(‘Links’), __(‘Pages’), __(‘Comments’), __(‘Appearance’), __(‘Plugins’), __(‘Users’), __(‘Tools’), __(‘Settings’), __(‘Contact’) … Read more

Sub menu with a URL parameter and access the page

I have checked your code. You are using incorrect menu-slug in add_submenu_page. Because admin already has page query var which conflicts with your menu slug page=settings&submenu=page2. I have updated the code. add_menu_page( ‘Main Menu’, ‘Main Menu Titlw’, $min_access_cap, ‘main-main’, array($this, ‘main_menu’), $icon_url, 999 ); add_submenu_page( ‘main-menu’, sprintf( __( ‘%1$s ‹ %2$s’, ‘main-menu’ ), $title[‘page_title’], ‘Submenu’ … Read more

How to remove the Tools menu item from the WP-Admin menu

You want to use remove menu page. <?php add_action( ‘admin_menu’, ‘wpse26980_remove_tools’, 99 ); function wpse26980_remove_tools() { remove_menu_page( ‘tools.php’ ); } You can drop that in your functions.php file (without the opening <?php most likely). That’s not going to prevent people from typing in yoursite.com/wp-admin/tools.php and seeing the tools page, however.

How can I use a different default admin menu icon for custom post type?

add_action( ‘admin_head’, ‘custom_post_type_icon’ ); function custom_post_type_icon() { ?> <style type=”text/css” media=”screen”> #menu-posts-intranet-pages .wp-menu-image { background: url(“PATH TO SMALL ICON”) no-repeat 6px 6px !important; } #menu-posts-intranet-pages:hover .wp-menu-image, #menu-posts-intranet-pages.wp-has-current-submenu .wp-menu-image { background-position:6px -16px !important; } #icon-edit.icon32-posts-intranet-pages {background: url(“PATH TO BIG ICON”) no-repeat;} </style> <?php } This way is much better I believe as it also allows to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)