Add taxonomy ID to Menu Class – WordPress

This snippet will let you add your custom taxonomy ID to your menu classes.

A somewhat typical WordPress menu classes would look like this:

I’ve created a custom menu from the WordPress admin > Appearance > Menus. Then added the custom taxonomy items:

custom taxonomy wordpress

Say we want to that custom taxonomy (client) and it’s ID to the menu item classes. The result we want should look like this:

See that we’ve added client-16 at the end? This can be very useful to style certain menu items or play with jQuery selectors.

Now, here’s the snippet you have to add to your functions.php file

2 comments

Leave a Reply

Add <code> Some Code </code> by using this tags.

*
*