type="text/css" />

How to set a minimum word count for multi-author WordPress blog post?


Suppose you are the owner of a multi-author WordPress blog and you want to set a minimum word count for each blog posted by your author. So bloggers won’t be able to post short blog posts.

Here is a tutorial on how to set a minimum word count for WordPress blog. Once the word count is set, an error will be displayed when a blogger tries to publish a blog shorter than the minimum word count.

Go to Dashboard > Appearance > Editor, open functions.php file and copy-paste the following code:

1
2
3
4
5
6
7
8
9
10
<?
function minWordCount(
$content
)
{
global $post
;
$content = $post
->
post_content
;
if (
str_word_count
(
$content
) < 100 ) //the minimum number of words
wp_die( __(
'Oops: your post is below the minimum word count. It needs to be at least 100 words or more.'
) )
;
}
add_action(
'publish_post'
, 'minWordCount'
)
;
?>

You have set the minimum word count to 100 words. You can change both the word count and the warning according to your blog standards.

Regards,
Jinnat Ul Hasan

By Jinnat Ul Hasan | On Tuesday, October 4th, 2011 | Under How To's | 1 Comment ยป


DO YOU NEED OUR HELP?

Contact our experts, most of the time we assist our readers free of charge.

Those who found this page were searching for:

  • how to count words in your blog post
  • word count multi-author wordpress
  • words minimum wordpress comments
  • wordpress blog wordcount
  • minimum word count for
  • wp word count limit multi author
  • text count content seo minimum
  • you want to set the author name for the comments.
  • wordpress minimum post content
  • where to set count words in post comment in wordpress

Previous post:

Next post: