Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Tsunamijaan/ceca3c2c7e80709aa70c4a02a3073fc0 to your computer and use it in GitHub Desktop.

Select an option

Save Tsunamijaan/ceca3c2c7e80709aa70c4a02a3073fc0 to your computer and use it in GitHub Desktop.
Require minimum word count to published post
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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment