Admin Notice Manager
A plugin to manage admin notices.
by Jahid Hossain · github.com/jahidhasan018/admin-notice-manager · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/jahidhasan018/admin-notice-manager/archive/refs/heads/main.zipManage WordPress admin notices safely from a dedicated admin page. This plugin stores notices in a custom database table and displays them across the WordPress admin.
Features
- Add and delete admin notices from a simple settings page
- Custom DB table (
{prefix}anm_notices) for robust storage - Secure add/delete actions with capability and nonce checks
- Proper WordPress admin notice styles: info, success, warning, error
- Full i18n-ready strings using text domain
admin-notice-manager - Uninstall cleanup drops the custom table and removes related options
Requirements
- WordPress 5.5+
- PHP 7.4+
Installation
- Copy the plugin folder
admin-notice-managerintowp-content/plugins/. - In WordPress admin, go to
Plugins→Activate“Admin Notice Manager”. - Activation will create the custom table using
dbDelta.
Usage
- Open
Admin Notice Managerfrom the left admin menu. - Enter a message and select a type:
Notice(treated as info)InfoSuccessWarningError
- Click
Save Notice. - The notice will:
- Render at the top of admin screens with the appropriate styling.
- Appear under the “Saved” list with a
Deletebutton.
How It Works
- Storage:
includes/class-anm-db.phpdefines a DB layer. Table schema:id BIGINT UNSIGNED AUTO_INCREMENTmessage TEXTtype VARCHAR(20)created_at DATETIME
- Admin page:
includes/class-anm-admin.phprenders the form and the saved list. - Actions:
- Add (
admin-post.php?action=anm_save_notice) sanitizes input and inserts into the table. - Delete (
admin-post.php?action=anm_delete_notice) removes byid.
- Add (
- Display: Hook
admin_noticesreads from the table and outputs notices with WP classes.
Security
- All modifying actions are protected by capability checks (
manage_options) and nonces. - All input is sanitized (
sanitize_text_field+wp_unslash). - All output is escaped (
esc_html,esc_attr).
Uninstall
- Removing the plugin via WordPress admin triggers
uninstall.phpwhich drops the custom table and deletes related options.
Development Notes
- Activation Hook:
anm_activate()creates the table viadbDelta. - Text Domain:
admin-notice-managerloaded onplugins_loaded.
License
GPL v2 or later.