This is not a mistake, WordPress intentionally does this (to save AFAIK changes). In any case, this may work, but it may be better than this (insert the file into your functions.php )
add_action( 'admin_notices', 'custom_error_notice' ); function custom_error_notice(){ global $current_screen, $post; if ( $current_screen->parent_base == 'edit' ){ if((!$post->post_name && !$post->post_content) && $_GET['post']) { wp_redirect(admin_url('post-new.php?empty=1')); } if($_GET['empty']) echo '<div class="error"><p>Warning - Please fill up all fields correctly!</p></div>'; } }
Also, it is necessary to use wp_redirect and avoid header already sent error message , insert this into your functions.php at the top of all other code
function callback($buffer) { // You can modify $buffer here, and then return the updated code return $buffer; } function buffer_start() { ob_start("callback"); } function buffer_end() { ob_end_flush(); } // Add hooks for output buffering add_action('init', 'buffer_start'); add_action('wp_footer', 'buffer_end');
source share