How to make content as required in custom post type?

the content_save_pre filter. It checks the post type of the current post and ensures that the content field is not empty. If the content field is empty, the function calls wp_die() to display an error message and stop the post from being saved.

Note: Make sure to replace “custom_post_type” with the actual name of your custom post type. Also, you can modify the error message to fit your needs.

add_filter( 'content_save_pre', 'validate_custom_post_type_content' );
function validate_custom_post_type_content( $content ) {
    global $post;
    if ( 'custom_post_type' === $post->post_type && empty( $content ) ) {
        wp_die( __( 'The content field is required for this custom post type. Please enter some content and try again.' ) );
    return $content;