You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor README examples for Notices class to enhance clarity and translation support
- Remove outdated examples and consolidate notice usage into a single example
- Update notice ID and message to include translation-ready strings
- Simplify documentation for adding notices using the admin_notices hook
This improves the usability of the README for developers implementing admin notifications.
}, 10 ); // Priority 10 runs before our render at priority 100
148
-
149
-
// This would NOT work - priority 200 runs after our render at priority 100
150
-
add_action( 'admin_notices', function() {
151
-
Notices::add( array(
152
-
'id' => 'too-late-notice',
153
-
'type' => 'error',
154
-
'message' => 'This notice will not display!',
155
-
) );
156
-
}, 200 ); // Too late - render already happened at priority 100
157
132
```
158
133
159
134
The notices will be automatically displayed on admin pages. The registry takes care of instantiating the `Notices` class, and the `Notices` class handles rendering and styling according to WordPress admin notice standards.
0 commit comments