Return to Snippet

Revision: 32434
at September 24, 2010 20:32 by gd6d


Initial Code
function maxWord($title){
    global $post;
    $title = $post->post_title;
    if (str_word_count($title) >= 10 ) //set this to the maximum number of words
        wp_die( __('Error: your post title is over the maximum word count.') );
}
add_action('publish_post', 'maxWord'

Initial URL
http://www.wprecipes.com/how-to-set-a-maximum-word-count-on-post-titles?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Wprecipes+%28WpRecipes.com%3A+Daily+recipes+to+cook+with+WordPress%29

Initial Description

                                

Initial Title
How to set a maximum word count on post titles

Initial Tags
wordpress, function

Initial Language
PHP