Created
January 5, 2019 08:51
-
-
Save Tsunamijaan/ceca3c2c7e80709aa70c4a02a3073fc0 to your computer and use it in GitHub Desktop.
Require minimum word count to published post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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