I recently wrote a tutorial on WPexplorer related to WordPress menus custom attributes. It’s something that isn’t covered that much on the internet and that’s why i wanted to make it a bit clearer. Many people don’t know that you can add your own custom fields to a menu, and it’s really handful if you want to create a great unique menu. I created a plugin based on this tutorial.
In a few words, WordPress menus already have some basic fields such “Description”, “CSS” etc… but they are generic. If you have to code a menu for a client and you use the “description” field to display a subtitle on the frontend, you’ll probably lost your client. But if you add a “subtitle” field to the administration to display a subtitle on the frontend, well that makes sense. Do you see the difference? It’s not that much, for me it’s really important.
So, based on the tutorial, i submitted a plugin to the WordPress repository. I called it “Sweet Custom Menu”. This plugin is working and can be used out of the box, but i prefer to consider it more like a base to create your own menu. I know that adding just a subtitle to a menu isn’t a revolution, but understanding how i did it can improve your approach to WordPress menu API.