Support » Plugins » How to limit words in Posts for User Input?

  • Hi There ,

    I have been looking for an answer to this and so far have not had any joy either through code or a plugin that does what I need

    Basically I am looking to limit how many words a user can input into a post/page say up to 300 words , On my blog I display full length blog posts as my boss does not want to have “read more” etc

    Most tutorials or code snippets are for limiting post title and excerpts and I tried to modify a working minimum word content but it never worked this is the code I have here :

    function maximum_number_words($content)
    	global $post;
    	$content = $post->post_content;
    	if (str_word_count($content) > 10 )
    	wp_die( __('The current post is above the maximum number of words, it must be under 10 words.') );
    add_action('publish_post', 'maximum_number_words');

    If anyone can help with the right code or plugin it would be much appreciated as its the last thing I need to do to complete the website I am working on!!



  • The topic ‘How to limit words in Posts for User Input?’ is closed to new replies.