Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

adriannei on "Change WP_Die error to view in dashboard"

$
0
0

I added a code in my functions.php to require the maximum words in order to publish for my authors. I have an article directory where people guest blog.

The only issues is that the Error message shown when you try to post something under X amount of words appears in another window saying:

"Error: Your post is below the minimum word count."

How can I get this error to show up right above the post title after they publish it?

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');

Viewing all articles
Browse latest Browse all 8245

Trending Articles