=== Menu Item Custom Attributes === Contributors: ponsiva Tags: menu, custom attributes, css class, id, navigation Requires at least: 5.0 Tested up to: 6.8 Requires PHP: 7.2 Stable tag: 1.2 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Easily add custom ID, Class, and Data attributes to WordPress menu items directly from the admin panel — no coding required. == Description == **Menu Item Custom Attributes** allows you to add HTML attributes such as `id`, `class`, and `data-*` directly to WordPress menu items from the admin interface. This plugin is perfect for developers and designers who want fine-grained control over menu elements for **styling, tracking, or custom scripting** — all without editing theme code. **Key Features** - Add unique HTML `ID`, CSS `Class`, or custom `Data` attributes to individual menu items - Works directly within the native **Appearance → Menus** screen - Compatible with **all themes and page builders** (Elementor, Astra, Divi, etc.) - Lightweight and performance-optimized - Safe and secure with sanitization and nonce checks Use it to apply special styles, attach JavaScript actions, or integrate with analytics tools like Google Tag Manager. == Installation == 1. Upload the plugin files to the `/wp-content/plugins/menu-item-custom-attributes/` directory, or install it via **Plugins → Add New** in WordPress. 2. Activate the plugin through the **Plugins** menu. 3. Go to **Appearance → Menus**. 4. Edit any menu item — you’ll see new fields to add **Custom ID**, **Custom Class**, and **Custom Data Attributes**. == Screenshots == 1. Menu editor showing new fields for ID, Class, and Data attributes. 2. Example front-end output with custom attributes applied. == Frequently Asked Questions == = Can I add multiple CSS classes? = Yes, you can add multiple classes separated by spaces, just like HTML. = Can I use this for tracking attributes (like data-gtm)? = Yes! Enter any valid `data-*` attribute such as `data-gtm="click"` or `data-event="cta"`. = Will it work with page builders like Elementor or Astra? = Absolutely. It’s designed to be theme-agnostic and builder-compatible. = Does it affect SEO or page speed? = No. It only modifies HTML attributes for menu items — no scripts or extra resources are added. = Can I safely uninstall it? = Yes. When uninstalled, it removes all associated custom meta keys from your database. == Changelog == = 1.2 = * Improved sanitization and validation for menu item fields. * Enhanced compatibility with WordPress 6.8. * Optimized uninstall script following coding standards. = 1.1 = * Added nonce verification and sanitization for plugin check compliance. * Added uninstall cleanup using delete_post_meta_by_key(). * Improved data attribute parsing and safety. * Updated code to meet WordPress coding standards. = 1.0 = * Initial release — added custom ID, class, and data attribute fields to menu items. == Upgrade Notice == = 1.1 = Security, performance, and compliance improvements. Update recommended for best compatibility. = 1.2 = * Added sanitization improvements and updated uninstall process. * Enhanced compatibility with WordPress 6.8. == Support == For feature requests, issues, or feedback, please visit the **[Support Forum](https://wordpress.org/support/plugin/menu-item-custom-attributes/)**. == License == This plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. == Credits == Developed and maintained by **Ponsiva Pandian** Website: [www.iamponsiva.rf.gd](www.iamponsiva.rf.gd)