Exclude stylesheet from admin

There are a couple of options. One is to wrap the enqueue in a check to see if it is the admin. if(!is_admin()) wp_enqueue_style(….); The other is wait to enqueue the style until template_redirect. function my_enqueue_styles() { wp_enqueue_style(….); } add_action( ‘template_redirect’, ‘my_enqueue_styles’ );

Admin Menus – Name Menu different from first Submenu [duplicate]

The first menu item typically is the parent item and shares the name with that item, you can however manually update the entry directly in the $submenu variable, like so.. add_action( ‘admin_menu’, ‘jp_create_admin_pages’ ); function jp_create_admin_pages() { global $submenu; add_menu_page(‘Members’,’Members’,’manage_options’,’members’,’jp_handle_admin_members’); add_submenu_page(‘members’,’Membership Types’,’Membership Types’,’manage_options’,’membership_types’,’jp_handle_admin_membership_types’); $submenu[‘members’][0][0] = ‘All Members’; } That way your parent keeps the original … Read more

How can I get an array/list of all current WordPress Admin Menu items?

<?php if (!function_exists(‘debug_admin_menus’)): function debug_admin_menus() { global $submenu, $menu, $pagenow; if ( current_user_can(‘manage_options’) ) { // ONLY DO THIS FOR ADMIN if( $pagenow == ‘index.php’ ) { // PRINTS ON DASHBOARD echo ‘<pre>’; print_r( $menu ); echo ‘</pre>’; // TOP LEVEL MENUS echo ‘<pre>’; print_r( $submenu ); echo ‘</pre>’; // SUBMENUS } } } add_action( … Read more

How to prevent parent admin page from appearring as a child admin page

Unless I misunderstand the question, this should do the trick: add_action(‘admin_menu’, ‘add_menu_pages’); function add_menu_pages() { add_menu_page(‘Menu Title’, ‘Menu Title’, 10, ‘main_menu’, ‘submenu_1_callback’); add_submenu_page(‘main_menu’, ‘Sub Menu Title 1’, ‘Sub Menu Title 1’, 10, ‘main_menu’ , ‘submenu_1_callback’); add_submenu_page(‘main_menu’, ‘Sub Menu Title 2’, ‘Sub Menu Title 2’, 10, ‘sub_menu’ , ‘submenu_2_callback’); } function submenu_1_callback() { echo “<h2>” . … Read more

Use latest jQuery in WordPress (admin interface)

Starting with version 3.6 WordPress actively discourages from deregistering “critical” scripts in admin at all. For posed scope (loading newer jQuery in specific part of admin) it would make more sense to load custom copy of jQuery normally and use noConflict() on it right away to isolate it in own variable to be used in … Read more

Javascript not working in admin

Script concatenation in admin area is normal behavior, but I am not sure that trying to load that many scripts is. You can disable concatenation by defining CONCATENATE_SCRIPTS constant to false. In wp-config.php would be fitting: define(‘CONCATENATE_SCRIPTS’, false); See Disable_Javascript_Concatenation in Codex. W3TC shouldn’t affect anything on admin side.