Skip to content

Commit dcc29fb

Browse files
committed
Properly hooked admin_notices
1 parent 2750dd5 commit dcc29fb

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

app/Utils.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ class Utils extends Plugin {
1717
*/
1818
public static function show_notice($msg, $type = 'error', $is_dismissible = false) {
1919

20-
$class = 'notice notice-' . $type . ( $is_dismissible ? ' is-dismissible' : '' );
21-
$msg = __( $msg, self::$settings['data']['TextDomain'] );
20+
add_action( 'admin_notices', function() use (&$msg, &$type, &$is_dismissible) {
2221

23-
printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $msg );
22+
$class = 'notice notice-' . $type . ( $is_dismissible ? ' is-dismissible' : '' );
23+
$msg = __( $msg, self::$settings['data']['TextDomain'] );
24+
25+
printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $msg );
26+
27+
});
2428

2529
}
2630

0 commit comments

Comments
 (0)