This topic contains 4 reply and 3 voices, and was last updated by MDelcour 5 years, 9 months ago
Viewing 4 Posts - 1 through 4 (of 4 total)
Author Posts
November 11, 2013 at 11:38 pm 9958
MDelcour I need to set a word count limit for the excerpt so users can't type more than 40 words in the excerpt. Do I need to create a new custom text area type that can be used in addition to 'Normal,' 'Rich' and 'Teeny Rich'?
November 12, 2013 at 12:08 am 9959
Tareq Hasan Tareq Hasan

This kind of functionalities doesn’t work in rich or teeny textareas, but works fine in normal textarea. Take a look at this tutorial achieving this.

November 12, 2013 at 1:49 am 9970
gpspake gpspake

Perfect. I’m going to try this out; I’ll report back with results. Thanks.

November 13, 2013 at 6:02 am 10019
gpspake gpspake

Ok, I’m back and that worked perfectly. I took it a step farther and added a character count in the help text by adding a line to the example jQuery. Now, in addition to the character limit, user see how many characters they have left. feel free to add this to the example doc as it is already very useful.

Help text:
Brief description to describe the post. <span class="excerpt-char-count">400</span> characters remaining.


//Text Limit for WPUFE
function wpufe_limit_text() {
  if ( is_page('test') ) {
	    <script type="text/javascript">
	        (function($) {
	            function limitText(field, maxChar){
	                var ref = $(field),
	                    val = ref.val();
	                if ( val.length >= maxChar ) {
	                    ref.val(val.substr(0, maxChar));
	            // Insert Limitations here
	            $('#post_excerpt').on('keyup', function(event) {
	                limitText(this, 400);
	                $( ".excerpt-char-count" ).html( 400 - $(this).val().length );	                

add_action( 'wp_footer', 'wpufe_limit_text' );
April 14, 2015 at 3:29 pm 41320
MDelcour MDelcour

You’re a LEGEND!! Great solution

Viewing 4 Posts - 1 through 4 (of 4 total)