Цей плагін не перевірявся з останніми 3-ма основними випусками WordPress. Можливо, він більше не може розроблятися або підтримуватися, і він може мати проблеми сумісності при використанні з більш новими версіями WordPress.

Navigation Menu IDs & Classes


This plug-in limits the classes WordPress added to navigation menus to only those desired by the Theme owner,
adds a unique ID to each li and removes any empty class attributes.

More about this plug-in can be found at:

Please let me know if you have any questions/suggestions/thoughts,



  1. Download the ZIP
  2. Unzip the ZIP
  3. Copy/paste the unzipped files into your WP plug-in directory (/wp-content/plugins/)
  4. From within WP’s Plugin Admin panel, Activate the ‘Navigation Menu IDs & Classes’ plug-in
  5. Choose which, if any, WP classes you wish to have in your HTML
  6. Marvel at the power of technology!

Часті питання

Why bother?
  • WP bakes in a ton of extraneous, border-line-useless, IDs and classes on navigation menu LIs (are you really going to
    target id="menu-item-72" or class="page-item-58" in your CSS?). This plug-in greatly reduces those classes,
    and adds classes that reflect the link’s page name, in slug form, so you can easily target menu LIs in your CSS.
What WP classes are allowed to remain?
  • Any that you choose.
Does this work with standard and custom menus?
  • Yes, both standard and custom menus will get class names that reflect the page name from the link they contain, such as:
  • About Us


03.09.2016 1 reply
At least some aspect of this plugin seems like it should be available in WordPress core. I understand the rationale for menu items having menu-item-ID, but it's pretty practical for them to have the slug in there, as this plugin provides. Suggestion for plugin feature - offer option for slug prefix. Like if I have a menu item "updates" I may use the class "updates" elsewhere, but class "menu-item-updates" would target the menu-item for sure. Of course I can currently use double selectors.
Прочитати всі 5 відгуків

Учасники та розробники

“Navigation Menu IDs & Classes” — проект з відкритим вихідним кодом. В розвиток плагіну внесли свій вклад наступні учасники:


Перекладіть “Navigation Menu IDs & Classes” на вашу мову.

Цікавитесь розробкою?

Перегляньте код, перегляньте сховище SVN або підпишіться на журнал розробки за допомогою RSS.

Журнал змін


* Fixing issue if no cusotm classes exist


* Added ability to retain custom class added via the Menus Admin page; thanks to Bryce for the idea, and sorry it took me so long to get around to!


* Fixed naming issue preventing plug-in from working and fixed screenshots


* Fixed an issue where individual checkboxes seemed to not respond to click (in fact, thanks to WP’s layout and jQuery’s bubbling, my toggle function was toggling twice). Was able to fix issue and remove the toggle function altogether. Thanks, Erin Allen!
* Fixed an issue where the for attribute for all of the labels was not getting added correctly. Now the label for each row spans the entire row, meaning you can click anywhere in a row to toggle that checkbox.
* Changed NMIC.checkboxes.attr to NMIC.checkboxes.prop in the checkall and uncheckall functions.


* Finally added the admin screen!
* Added if ( ! function_exists( '...' ) ): blocks around each plug-in function
* Changed function namesspace from nmic to NMIC
* Still want to find a way to gather possible WP class names programmatically, for “this” version of WP; any ideas?


* Page name slug classes were not working; this has been fixed. Thanks to Christopher Bright for getting me to look into this.
* Removed nmic_remove_empty_classes function, as it is no longer necessary now that all nav menu LIs will have at least one class: the page name slug.


Well, this is the first version, so… here it is, hope you like it!