How Can I remove or hide the export page in WordPress menu?

Whenever in doubt about a WordPress function, consult the Codex: Function_Reference/remove_menu_page. The correct function is remove_submenu_page hooked into admin_menu. add_action( ‘admin_menu’, ‘remove_submenu_wpse_82873’ ); function remove_submenu_wpse_82873() { global $current_user; get_currentuserinfo(); // If user not Super Admin remove export page if ( !is_super_admin() ) { remove_submenu_page( ‘tools.php’, ‘export.php’ ); } } And then you’d probably would like … Read more

Admin sidebar items overlapping in admin panel

This is a known issue. The current fix (which may also make it into core) looks like this: add_action( ‘admin_enqueue_scripts’, ‘chrome_fix’ ); function chrome_fix() { if ( strpos( $_SERVER[ ‘HTTP_USER_AGENT’ ], ‘Chrome’ ) !== false ) { wp_add_inline_style( ‘wp-admin’, ‘#adminmenu { transform: translateZ(0) }’ ); } }

Order Admin sub-menu items?

The filter ‘custom_menu_order’ will not work on the menu order because apply_filters in wp-admin/includes/menu.php supplies false as the filtered content. You can try changing false to $menu and the filter works grand. Since we obviously can’t touch the core, here’s how I got it to work: function custom_menu_order(){ global $submenu; $find_page=”edit.php”; $find_sub = ‘Post Tags’; … Read more

List table not rendering when $this->items is filled

I did same error first time I implemented WP_List_Table. The problem is that when you call WP_List_Table::display() WordPress in turn calls: WP_List_Table::display_rows_or_placeholder() WP_List_Table::display_rows() WP_List_Table::single_row() WP_List_Table::single_row_columns() Last function is called for every row. If you look at its code (see source), it has: if ( ‘cb’ == $column_name ) { // you don’t have ‘cb’ column, … Read more

Add visit site to your toolbar instead of being in the dropdown

Not complicated, but a little tricky to get timing right. Something like this should work, but you might need to experiment with priority to get the link to specific position on the bar: add_action( ‘admin_bar_menu’, function ( $wp_admin_bar ) { if ( ! is_admin() ) { return; } /** @var WP_Admin_Bar $wp_admin_bar */ $wp_admin_bar->remove_node( ‘view-site’ … Read more

remove_menu_page doesn’t work on custom plugin menus

Place this below temporary code in your functions.php or any where that can be executed. add_action( ‘admin_init’, ‘the_dramatist_debug_admin_menu’ ); function the_dramatist_debug_admin_menu() { echo ‘<pre>’ . print_r( $GLOBALS[ ‘menu’ ], TRUE) . ‘</pre>’; } Then search for the plugin-slug. In which array you find it copy the [2] value and put it in remove_menu_page(‘the [2] value’) … Read more

Add an admin page, but don’t show it on the admin menu

Use a submenu page as parent slug. The admin menu has just two levels, so the imaginary third level will be hidden. Sample code, tested: add_action( ‘admin_menu’, ‘wpse_73622_register_hidden_page’ ); function wpse_73622_register_hidden_page() { add_submenu_page( ‘options-writing.php’, ‘Hidden!’, ‘Hidden!’, ‘exists’, ‘wpse_73622’, ‘wpse_73622_render_hidden_page’ ); # /wp-admin/admin.php?page=wpse_73622 } function wpse_73622_render_hidden_page() { echo ‘<p>hello world</p>’; }

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