Title: length limit?
Last modified: August 20, 2016

---

# length limit?

 *  Resolved [mpmchugh](https://wordpress.org/support/users/mpmchugh/)
 * (@mpmchugh)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/length-limit/)
 * There seems to be a length limit of 156 characters. Can this be increased?
 * Thanks.
 * [http://wordpress.org/extend/plugins/subheading/](http://wordpress.org/extend/plugins/subheading/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [mpmchugh](https://wordpress.org/support/users/mpmchugh/)
 * (@mpmchugh)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/length-limit/#post-3456956)
 * Nevermind. It seems there was something odd about the data when pasted in that
   truncated it.
 *  [edupison](https://wordpress.org/support/users/edupison/)
 * (@edupison)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/length-limit/#post-3457252)
 * Is there any way to stablish a lenght limit by characters?
 * Thank you
 *  Plugin Author [Steve](https://wordpress.org/support/users/stvwhtly/)
 * (@stvwhtly)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/length-limit/#post-3457255)
 * Hi,
 * As of the recently committed version 1.7.1, it is possible to limit the subheading
   displayed using the new `subheading` filter.
 * For example, the following can be added to your theme functions.php file to limit
   the subheading to 5 words.
 *     ```
       add_filter( 'subheading', function( $value ) {
           return wp_trim_words( $value, 5 );
       } );
       ```
   
 * If you require an exact number of characters, simply change the contents of the
   filter to manipulate the output to the desired format.
 * Hope this helps.
 *  [edupison](https://wordpress.org/support/users/edupison/)
 * (@edupison)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/length-limit/#post-3457257)
 * I’m sorry, I don’t know almost nothing about PHP. What shoud I do with this code?
   Just paste it in function.php? I’ve tried pasting this at the top of the file,
   but gives me error.
 *     ```
       <?php add_filter( 'subheading', function( $value ) {
           return wp_trim_words( $value, 5 );
       } ); ?>
       ```
   
 * Parse error: syntax error, unexpected T_FUNCTION in (…)/functions.php on line
   1
 * Thanks in advance!
 *  Plugin Author [Steve](https://wordpress.org/support/users/stvwhtly/)
 * (@stvwhtly)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/length-limit/#post-3457261)
 * Hi,
 * OK, not to worry – let’s try and solve this one.
 * It could be and issue with PHP versions, the method used in the snippet (anonymous
   function) will only work in PHP 5.3 of greater.
 * First option would be to check which version you are using, and then replace 
   what you have with this alternative.
 *     ```
       function trim_subheading( $value ) {
           return wp_trim_words( $value, 5 );
       }
       add_filter( 'subheading', 'trim_subheading' );
       ```
   
 * If this isn’t the problem we can move on to something else.
 *  [edupison](https://wordpress.org/support/users/edupison/)
 * (@edupison)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/length-limit/#post-3457262)
 * Now it doesn’t give an error, but is still not working. My vesion is greater 
   than 5.3.
 * Where should I notice the limit? In the subheading box, in the WordPress backend,
   accepting only five words? Or maybe it should let me write as many words as I
   want and later, in the frontend, show only the first five words?
 * Thanks again!
 *  Plugin Author [Steve](https://wordpress.org/support/users/stvwhtly/)
 * (@stvwhtly)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/length-limit/#post-3457263)
 * OK, that’s sounds good to me.
 * Using this filter will not limit the number of characters you can enter into 
   the input on the edit page, it only has an affect on the final output.
 * So you could enter “This is my example subheading that is too long.”, but using
   the filter with a 5 word limit will only display “This is my example subheading”.
 * There are other options you can use with the wp_trim_words function, found in
   the Codex:
 * [http://codex.wordpress.org/Function_Reference/wp_trim_words](http://codex.wordpress.org/Function_Reference/wp_trim_words)

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘length limit?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/subheading_f4f4f4.svg)
 * [SubHeading](https://wordpress.org/plugins/subheading/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/subheading/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/subheading/)
 * [Active Topics](https://wordpress.org/support/plugin/subheading/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/subheading/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/subheading/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [Steve](https://wordpress.org/support/users/stvwhtly/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/length-limit/#post-3457263)
 * Status: resolved