Is it possible to limit the Excerpt field on the post page in words? Note that I am aware that it's possible to echo the excerpt and limit it in words, but I want the field itself to limit the amount of words, similar to how character limits on text-areas work.

Is such thing possible? Maybe a Javascript solution? Maybe something similar to what this plugin does to the character bio field (although its limitation is based on amount of characters).

The reason of this is that I run a multiple author platform where users often make the mistake to exceed the word limit that is being printed in the list of posts.

  • Check here, here and here. And reminding that it is ok to answer your own Q :)
    – brasofilo
    Commented Nov 10, 2012 at 21:41

1 Answer 1


You can use something like jQuery Simply Countable plugin and attach it to excerpt input.


class Limit_Excerpt_Words {

    static function on_load() {

        add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) );


    static function admin_enqueue_scripts() {

        global $hook_suffix;

        if ( 'post.php' == $hook_suffix || 'post-new.php' == $hook_suffix ) {

            wp_enqueue_script( 'jquery-simply-countable', plugins_url( '/jquery.simplyCountable.js', __FILE__ ), array( 'jquery' ), '0.4.2', true );

            add_action( 'admin_print_footer_scripts', array( __CLASS__, 'admin_print_footer_scripts' ) );

    static function admin_print_footer_scripts() {

  <script type='text/javascript'>
      jQuery(document).ready(function ($) {

              countType:'words', maxCount:5, strictMax:true


  <span id="counter" style="display:none;"></span><!-- needs counter to work -->

PS there is also word-count.js in WP core, but I can't make sense if it's as easy to use for blocking stuff.

  • Can you please provide me more information about exactly how I attach it to the excerpt input. I will admit that I am a bit confused about how to go about this. Thank you for the respond regardless. Commented Nov 11, 2012 at 20:12
  • @Amanda Duke example code in answer already does that ($('#excerpt')... part).
    – Rarst
    Commented Nov 12, 2012 at 11:23
  • Yes I found that, I was referring to how I add this example code to my site? Add it to functions.php? Commented Nov 12, 2012 at 16:22
  • @Amanda Duke this is coded like a basic plugin and the only think that will differ depending on where you put it is URL to script file. "Where code goes" is hard question to answer because there are umpteenth places to put it and you are supposed to decide that, depending on your needs and setup you have.
    – Rarst
    Commented Nov 12, 2012 at 19:06
  • Sorry about the late reply, my account was temp suspended. Back to the subject, yes I fully understand what you mean about how to implement the code, this was not an issue. I was asking the question as I tried it already as a plugin (added full path to the js file) and nothing happened... therefore I suspected that the code may need to be added somewhere else. Nonetheless, have you tested this code? Maybe there is a typo somewhere that is preventing it from functioning? Thanks for the reply. Commented Nov 21, 2012 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.