=== Notifications Hider ===

Contributors: leprincenoir
Tags: admin notices, notifications, admin, clean admin, notification center
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Hide admin notices from unauthorized users, keep the important ones visible, and group yours in a notification center.

== Description ==

=A PLUGIN TO HIDE WORDPRESS NOTIFICATIONS FROM UNAUTHORIZED USERS.=

Notifications Hider is a WordPress plugin designed to improve the security and management of notifications on your site. It allows you to hide administrative notifications from unauthorized users, ensuring that only the relevant people receive critical information.

With Notifications Hider, you can :

- Control who can see WordPress notifications: choose the administrators allowed to see them, everyone else sees nothing.
- Ensure a cleaner, less cluttered administration experience.
- Improve security by limiting access to sensitive information.
- Keep important notices visible: detected notices are listed by plugin, theme or WordPress core, and you choose the exceptions that stay visible to everyone.
- Group your own notices in a notification center: a bell icon in the toolbar, with a counter, opens a panel listing the notices of the current page instead of stacking them at the top of every screen.
- Hide anything else with custom CSS, for the rare notices that do not use the standard WordPress hooks.

= How it works =

Notices printed through the standard WordPress hooks (`admin_notices`, `all_admin_notices`, `network_admin_notices`, `user_admin_notices`) are removed right before being displayed to unauthorized users. Authorized administrators keep seeing everything, either at the top of the pages or in the notification center.

The settings page shows a plain-language summary of the current behavior: who sees notices, what other users see, and whether the notification center is enabled.

== Languages / Localization ==

Notifications Hider is translated into English and French.

If you'd like to translate the plugin into your language, [please click here](https://translate.wordpress.org/projects/wp-plugins/notifications-hider/).

== Frequently Asked Questions ==

= Who can use Notifications Hider? =
Notifications Hider is designed for everyone, with no coding skills required.

= What happens if no administrator is selected? =
All site administrators see the notices. Other users (editors, authors…) never see them, except the exceptions you check in the settings.

= What is an exception? =
A notice checked in the "Exceptions: always visible to everyone" list. It is displayed to every user, including unauthorized ones, and it is never moved to the notification center. By default, leave everything unchecked and keep this for important alerts only.

= Why is a notice missing from the exceptions list? =
Notices are detected when they are displayed to an administrator. Browse the page where the notice appears, then reload the settings page. Notices printed directly in a page, without the `admin_notices` hooks, cannot be detected.

= The notification center shows different notices depending on the page. Is that normal? =
Yes. WordPress does not store notices: each plugin decides, on every page, whether to display one. The panel lists exactly the notices the current page would have displayed at the top.

= Why does the notification center ignore some hidden notices? =
Some plugins insert hidden notices that their scripts reveal later, for example WooCommerce's "Connection lost" message. They are left in the page, hidden, and are not counted as notifications.

= Are notices in the block editor hidden? =
No. The block editor displays its notices through JavaScript, not through the classic `admin_notices` hook. The notification center is not used in the block editor either. Use the custom CSS field to hide specific elements if needed.

== Screenshots ==

1. Before -> Low visibility
2. After -> Optimal visibility
3. Settings: notification center and exceptions, detected notices grouped by plugin
4. Notification center: the bell icon in the toolbar opens the panel

== Changelog ==

= 1.1.0 =
* New: exceptions. Detected notices are listed by plugin, theme or core in the settings; checked ones stay visible to everyone.
* New: notification center. Authorized administrators can group notices in a panel opened from a bell icon in the toolbar, with a counter.
* New: plain-language summary of the current behavior on the settings page, with a warning when every notice is an exception.
* Fix: fatal error for non-administrator users when no administrator was selected in the settings.
* Security: settings are now sanitized on save (administrator IDs validated, HTML tags stripped from custom CSS).
* Security: custom CSS is printed through the WordPress styles API instead of a raw `<style>` tag.
* Fix: CSS child selectors (`>`) are no longer broken by HTML escaping.
* Improvement: notices are removed right before being printed, so late-registered notices (including network and user admin notices) are hidden too.
* Improvement: uses the core code editor (`wp_enqueue_code_editor`), respecting the user's syntax highlighting preference.
* Improvement: authorization is computed once per request; plugin no longer runs on AJAX requests.
* Improvement: options are deleted on uninstall.
* Compatibility: tested up to WordPress 7.1, PHP 7.4 to 8.5.

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.1.0 =
Fixes a fatal error for non-administrator users and hardens settings sanitization. Recommended update.
