koko-ng / admin-notice
Simply set notices from various save_post hooks
Installs: 70
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=8.1
Requires (Dev)
README
Simply add admin notices for all post saving hooks.
You can either set the notice using set_notice_status
or wrap your hook with with_error_notice
, then all the errors will be catched and send displayed as a notice on the admin UI.
Features
- Gutenberg notices
- Classic editor notices
Installation
composer require koko-ng/admin-notice
Examples
require 'vendor/autoload.php'; add_action('acf/save_post', \Admin_Notice\with_error_notice( 'my_acf_save_post') ); function my_acf_save_post( $post_id ) { // You can use `\Admin_Notice\Exception` to set a notice level. throw new \Admin_Notice\Exception("Error message", 0, \Admin_Notice\NoticeLevels::Warning); }