Define a minimum word count in a post – WordPress

Add the below given code into your functions.php

function phpcodez_check_word($content){
global $post;
$num = 50; // set number of words required in a post
$content = $post->post_content;
if (str_word_count($content) < $num) wp_die( __('The post does not have the minimum number of words') ); } add_action('publish_post', 'phpcodez_check_word');

Leave a Reply

Your email address will not be published. Required fields are marked *