The following does the job:
add_action( 'admin_init','wpse_60168_custom_menu_class' );
function wpse_60168_custom_menu_class()
{
global $menu;
foreach( $menu as $key => $value )
{
if( 'Posts' == $value[0] )
$menu[$key][4] .= " custom-class-1";
if( 'Pages' == $value[0] )
$menu[$key][4] .= " custom-class-2";
}
}
And if you want to inspect what the $menu
contains, use this:
add_action( 'admin_init','wpse_60168_var_dump_and_die' );
function wpse_60168_var_dump_and_die()
{
global $menu;
echo '<pre>' . print_r( $menu, true ) . '</pre>';
wp_die();
}
Related Posts:
- Remove update nags for non-admins [duplicate]
- Any guides on creating custom admin pages?
- Remove Customize Background and Header from Appearance admin menu without CSS or JS
- renaming an admin menu item with decimal array index number
- Jquery no more loading, load-scripts.php not found (404)
- Admin Bar (Toolbar) not showing on custom PHP file that loads WordPress
- How do I remove a require_once admin panel from the parent theme from the child theme functions.php?
- Handling error states with admin_post
- Installing wp3.2.1 on IIS; getting empty sessions
- Adding Field to Profile “Name”
- Admin Menus – Name Menu different from first Submenu [duplicate]
- When is is_admin() available?
- Creating a new page and automatically associating it with a template in WordPress
- Unable to set right time in admin and frontend template
- List User order by ID in Descending order (Backend)
- Why is this Ajax not working?
- Admin Options page. Save as Array
- WooCommerce – Email admin with new user details
- Correct folder permissions?
- Selectbox in admin panel function linking to CSS
- Sort custom meta column by other meta value
- running wp-cron.php using php not wget
- Programmatically create page when saving custom post type post
- Building a WordPress App
- How can I open up my administrative panel to everyone?
- retain querystring values when savincustom options in admin
- Get categories names as an array to use it in theme settings
- Get Page ID from Backend
- Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?
- Removing custom sort order from admin page listing
- I installed WordPress locally now how do I login?
- Adding a ‘style=’ bit to image_send_to_editor output
- Get options from database using php class
- Limit ‘contributers’ abilities in WordPress
- In PHP how do I make my navigation bar show certain links to admins only?
- Woocommerce display orders with products from specific categories to specific admins
- PHP warning – Use of undefined constant ‘FORCE_SSL_LOGIN’ ‘FORCE_SSL_ADMIN’ on wp-config.php
- admin panel – How to remove “delete” button from category editing page
- wordpress email checker on domain
- problem connecting to the administrator
- How to add a DELETE button to the “Edit User” WordPress admin page?
- Editing the term_order field
- Access to “My Site” is missing from the admin bar
- wordpress ajax return 0
- Dynamic form variables for post meta
- Include administrator in author list
- Shortcodes (with a space) added to php Sample
- Image not displayed
- Adding Media button to only pages
- Forbid certain users to access a specific page
- One folder to be accessible by one user
- Exclude Everywhere but Admin Area?
- AJAX WP_Query’s order and orderby parameters not working
- Custom plugin: Trying to show saved data on frontend
- ob_get_clean returns empty string, ob_get_flush outputs string
- Edit postmeta when user changes user role?
- Pagenavi pagination via wp-query in functions.php showing same content for each page
- Looping through WP_Post Object
- PHP contact form returns warning in text widget [closed]
- Executing `createimagefrompng()` from save_post hook (or equivalent hook)
- Delete option value from array using update_option()
- child theme inherticance and php autoload
- Theme currently showing thumbnails, how to show full size?
- How do you add customer capability after Woocommerce purchase?
- Change sign up fee in cart for subscription products WooCommerce
- How to put a variable in a instance in the widget
- How do I list the child of a child page [duplicate]
- how to remove metadata from the posts of my blog?
- How can I create a list of page titles from custom meta values?
- get a simple array of all of the term names that exist in all taxonomies
- Show categories then when clicked on a category list all sub category and when clicked show all posts in that sub category
- Cron job update csv, need help solving :-)
- Extend plugin Class through functions.php
- How can I edit the content in index.php? [duplicate]
- Website needs to be opened for wp_mail to work
- Conditional Javascript based on WP Version
- Underscore – Self hosted fonts
- Does WordPress create a new Linux user when creating a new WordPress blog?
- How to remove the h6 tag for the entry-category Class
- Can’t add script immediately after the opening tag on login page?
- How to turn each phone number within the $content to a telephone link?
- Processing ajax call to php to insert into mysql database
- WordPress Search
- Show different size featured images (the_post_thumbnail) for 1st, 2nd and 3rd posts?
- Pagination stays on same page for post category
- I get “Cannot modify header information – headers already sent” when I change my theme
- Create an array with all the links of the years’ archive (of a custom post type)
- get_results() doesn’t fetch the result
- How can i find wrong word in search box and replace with correct word
- How to override WooCommerce Order Item Meta with data from Cart?
- Meta query not showing result properly
- How does WordPress rewrite URLS using its PHP scripts
- WordPress add_rewrite_rule
- Help on Wp_query to print an term
- List all blogs apart from the current blog and main blog in WordPress Multisite
- Break a WordPress function to run in patches and re-continue
- Post content not showing some content
- How to create a container in php then customise it in CSS
- How to add SKU and remove product title from WooCommerce url?
- php 8 compability admin interface