Block to Add Post in Wordpress
Copy Below Code
View As A Text File
Show Text Only
Show API
Edit Code
add_action( 'transition_post_status', 'rfi_guard', 10, 3 );
function rfi_guard( $new_status, $old_status, $post ) {
if ( $new_status === 'publish' && rfi_should_stop_post_publishing( $post ) ) {
wp_die( rfi_get_warning_message() );
}
}