Advertisement
napolux

WordPress count chars in post and forbid publication

Apr 20th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.31 KB | None | 0 0
  1. function minCharCount($postID_dummy, $post) {
  2.   $content = $post->post_content;
  3.   if (strlen(strip_tags($content)) < 1000 ) // minimo 1000 caratteri
  4.     wp_die( __('Error: your post is below the minimum char count. It needs to be 1000 or more chars.'));
  5. }
  6.  
  7. add_action('publish_post', 'minCharCount', 1, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement