Sometimes you wish to define a minimum word count per post for different authors. Well, this can be possible by simply copying and pasting the snippet to your theme’s functions.php file.
1 2 3 4 5 6 7 8 | function minWord($content){ global $post; $num = 100; //set this to the minimum number of words $content = $post->post_content; if (str_word_count($content) < $num) wp_die( __('Error: your post is below the minimum word count.') ); } add_action('publish_post', 'minWord'); |
Snippet Source/Credit: Pippin Williamson