Minimum Length for WordPress Posts, except for admin

I set Minimum Length for WordPress Posts”,but my need is to except admin all should follow Minimum Length for WordPress Posts

//How to Set a Minimum Length for all WordPress Posts for all user except admin like all user will be restricted to x words except admin can post any words

Below code Set a Minimum Length for all WordPress Posts for all user even admin which i dont want so plz help

//How to Set a Minimum Length for WordPress Posts
function display_short_error_message($messages)
{

global $post;
$content = $post->post_content;
if (str_word_count($content) < 699 ) {
$error_message = ‘Post Should be at Least 699 Words’;
add_settings_error(‘post_short_error’, ‘’, $error_message, ‘error’);
settings_errors( ‘post_short_error’ );
$post->post_status = ‘draft’;
wp_update_post($post);
return;
}

return $messages;

}

add_action(‘post_updated_messages’, ‘display_short_error_message’);

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.