The filter
Inside /wp-admin/menu.php, you’ll find this filter at the end of the “add css classes”-loop:
apply_filters( 'add_menu_classes', $menu )
The function
The following code attaches the right classes to the first and previous elements. It also adds the separator in between. If you need to add another separator to the end/after your group, you’ll have to extend the function to do the following:
- Take the last element in your group and treat it exactly as you currently treat your previous element.
- Add the separator one key after your last element
- Add the same classes to the following/next element right after your group
- Check if there’s not already a separator in place. See current check.
Use the $target
array to look up for the names of the targeted menu elements. Just use exactly what you see in your menu and it adds a separator before the element.
Related Posts:
- Need functionality with all post list available at edit.php
- Sorting custom post types in edit.php : Post disappear
- Can’t preview custom post – Redirected to home page
- How come Featured Image isn’t showing up in my Custom Post Type?
- Redeclare/Change Slug of a Plugin’s Custom Post Type
- Change the text on the Publish button
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- Row actions for custom post types?
- How to use a custom post type archive as front page?
- How to change default position of WP meta boxes?
- Loading External Scripts in Admin but ONLY for a Specific Post Type?
- Register CPTs using Dashicons for admin menu icon in WP 3.8
- How can I remove the “Add New” button in my custom post type?
- Displaying Custom Post Types In “At A Glance” Meta Box
- Sort search results by post type
- Remove “posts” from admin but show a custom post
- Display a query with multiple post types and same relationship on a single page
- Set posts of a custom post type to be private by default?
- Add content in custom post type page after the title and before columns
- Change the edit page for a custom post type?
- How to check if I’m on a custom post type archive in the admin area
- Custom post status not working
- Admin Filter – Add Post Type Description on Post Type Page
- How do I filter the excerpt metabox description in admin?
- clients list using wordpress
- How to add custom columns to Custom Post Type admin screen
- Is it OK to move admin menu items?
- expire wordpress user posts
- Hide/Show only specific categories in wp-admin new-post.php
- Best way to filter featured image text for a custom post type?
- WordPress Custom Post Type Admin Page really slow
- echo value from ‘select’ field type into page template using cmb2?
- Add content before/after admin post wp-list-table
- Custom post type Admin Page
- Forcing all posts associated with a custom post type to be private
- Post slug changed using code doesn’t reflect on editor when post is published
- Filtering Posts by Multiple Taxonomy Terms such as in an Admin Post Listing?
- WP Admin default view mode for Custom Post Type
- Exclude add_filter from the admin
- Find callback function for custom taxonomy metabox
- Date archives for custom post type
- WordPress 3.1 – How does one add sticky post capabilities to post types
- How can I add dropdown widget/box to admin post page?
- Remove date and category filters when editing custom post types
- Detect meta value changes when post is updated (post_updated)
- Ordering Post 2 Post admin meta box by meta from CPT
- Search everything (posts, pages, tags, cpt, meta)
- Custom Metabox with Taxonomy Dropdown – Saving Issue
- how to create my own edit.php admin page code or template for my custom post type
- Posts to expire (deleted) after a date
- White screen error for a custom theme
- How to Removing fields from the Media Uploader/Gallery on a Custom Post Type Edit Page
- Displaying Post Title on Post Edit page?
- Best way to style first post differently?
- Using Default WordPress Custom Header Image Crop Feature in a Post Type / MetaBox
- How do I add a custom post type to the Featured Content in twenty fourteen theme?
- Backend search; include CPT meta?
- Automatically assign a custom post to a custom taxonomy based on custom field value
- Exclude Custom Post Type & Pages From Auto-Tag Function
- Saving multiple Metabox contents
- Limiting number of custom posts shown on taxonomy page
- How to programatically set the post title of a CPT on wp-admin
- if && problems with transition_post_status
- Is it possible to insert text into an html tag using functions.php?
- Custom user role not working as expected
- How to Change the Title of a Meta Box on a Specified Custom Post Type? [duplicate]
- Custom post type loops with different page templates
- custom post type upcoming post and past post
- Make a custom column sortable, by custom post count
- Sort custom post types by last name in the backend
- Using multiple instances of wp_editor in Custom Post Type admin area
- Limit Authors to their Own Posts on front-end excluding admins
- How i add new link after Edit | Quick Edit | Trash | View in quick edit section
- Custom Post Type Name Causing Problem
- Add multiple custom post types in functions.php, but only one custom post type show in dashboard
- How to add post_author column to custom post type
- Multiple Content Block
- Use a textarea for a custom post type
- Unable to save or update postmeta for custom post type via action using save_post hook
- Restrict categories to a custom post type
- Changing the header on post listing page in admin area
- Beginner question: Accessing functions.php through admin web interface in order to import custom post types?
- Append taxonomy terms as class names in markup?
- How to: add option to add more checkboxes on custom post type
- How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”
- WordPress User Roles, Custom Post Types, and Admin views
- Allow Users Access to Custom Post Type Only
- Add text to post list/edit screens?
- How do you output custom code between posts in the loop?
- Display only custom post type count for current author on the “At a Glance” dashboard widget
- Adding menu_order to CPT admin page
- Remove “Get Shortlink” button in admin of custom post type
- Post the content of a specific “Custom Post Type” post within a post using a shortcode
- How to get Custom Post ID by adding filter to child theme’s function
- Show hierarchical relationship between to custom post types on admin list
- Show Custom Post Type values in WordPress grid view
- How to make in WordPress admin panel sortable column for the custom field, that count the number of page impressions?
- WP-Admin edit.php & post.php slowdown after import of 10k users
- Remove default post types on all sites except primary blog. WPMU
- How to remove ‘create new post’ entry for a custom post type?