Easily add custom fields to nav menu items.
1.0.0, the first parameter passed to the
wp_nav_menu_item_custom_fields is the menu item ID, instead of the nav menu ID. This should not have a big impact, since the nav menu ID passed was always
0 (not used by core).
This is a library plugin. It doesn't do anything visible on its own. It was written to allow other plugins/themes to add custom fields to menu items easily. See Installation.
- Pass correct parameters to the
wp_nav_menu_item_custom_fieldshook, props @helgatheviking.
- Support WordPress 4.7, props rahulnever2far.
wp_nav_menu_item_custom_fieldsas walker hook. See this blog post.
- Update example plugin
- Update compatibility info
- Improve walker class loader
- Move custom fields up (before
- Initial public release
As regular plugin
- Activate the plugin through the 'Plugins' menu in WordPress
As library in your plugin/theme
menu-item-custom-fields to your plugin directory and require the main plugin file, eg:
require_once dirname( __FILE__ ) . '/menu-item-custom-fields/menu-item-custom-fields.php';
Copy (and customize) and include the
menu-item-custom-fields-example.php file found in the
doc/ directory of this plugin into your plugin/theme.