Last active
September 14, 2017 12:33
-
-
Save jasonglisson/4e397e822233d7678d81 to your computer and use it in GitHub Desktop.
Wordpress: Set Maximum Post Title Length
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment