=== AddonLogic Role-Based Menu Items ===
Contributors: snehalpancholi
Tags: menu, navigation, user roles, visibility, access control
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.1
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show or hide individual nav menu items based on login state or user role — server-side, no markup leaked to guests.

== Description ==

AddonLogic Role-Based Menu Items lets you attach a visibility rule to every nav menu item in Appearance → Menus. Rules are enforced on the server, so hidden items produce no HTML output at all.

**Visibility rules**

* **Everyone** — always shown (default)
* **Logged in users only** — hidden from guests
* **Logged out visitors only** — hidden from logged-in users (great for Login / Register links)
* **Specific roles** — shown only to users who hold at least one of the selected roles

**Features**

* Per-item rule picker in the WordPress menu editor
* Role checkboxes expand dynamically when "Specific roles" is chosen
* Child items of a hidden item are also hidden automatically
* No caching side-effects — rules evaluate per-request via `wp_get_nav_menu_items` filter
* Zero frontend assets added

== Installation ==

1. Upload the `role-based-menu-items` folder to `/wp-content/plugins/`.
2. Activate the plugin.
3. Go to **Appearance → Menus**, expand any menu item, and choose a **Visibility rule**.

== Frequently Asked Questions ==

= Does it work with caching plugins? =
Because item filtering is applied via a WordPress PHP filter, full-page caches that serve the same cached HTML to all visitors may bypass this plugin's rules. Use per-user fragment caching or a dynamic sidebar when mixing logged-in/out rules with aggressive full-page caching.

= Can I show an item only to administrators? =
Yes. Choose "Specific roles" and tick "Administrator".

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
