Admin notices are not shown in save post hook with wp5

Question

When saving the post, admin notices is not shown.

Simplified code:

add_action ( 'admin_notices', 'ltb_show_admin_notices' );

function ltb_show_admin_notices() {
    // The function is not called at all!!!!
    error_log("CALLED ltb_show_admin_notices");
    echo sprintf ( '<div class="notice notice-warning is-dismissible"><p>%s</p></div>', 'NOT SHOWN' );
}

add_filter ( 'content_save_pre', 'ltb_save_post' );

// ... on saving a post
function ltb_save_post($content) {
   // Do something
}

Admin notices are shown during initializing of plugin.

What am I doing wrong? Any ideas? TIA!

It has worked perfectly with WP4.

0
t777 3 months 0 Answers 14 views 0

Leave an answer