Title: Title length
Last modified: August 21, 2016

---

# Title length

 *  [James G](https://wordpress.org/support/users/james-g/)
 * (@james-g)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/title-length-1/)
 * Hello
 * Please, I’d like to know how can I limit the title length of the imported posts?
 * I saw the code below, but I can’t figure out where to add it.
 * Thanks
 * James
 *     ```
       add_filter( 'dsgnwrks_instagram_pre_save', 'dsgnwrks_qa_make_title_excerpted' );
       function dsgnwrks_qa_make_title_excerpted( $import ) {
   
       if ( isset( $import['post_title'] ) ) {
   
       // feel free to edit these 2 values
       $number_of_words = 5;
       $more = '...';
   
       $import['post_title'] = wp_trim_words( $import['post_title'], $number_of_words, $more );
       }
   
       return $import;
       }
       ```
   
 * [https://wordpress.org/plugins/dsgnwrks-instagram-importer/](https://wordpress.org/plugins/dsgnwrks-instagram-importer/)

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

 *  Plugin Author [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * (@jtsternberg)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/title-length-1/#post-5141184)
 * You can put that code inside your theme’s functions.php file. For reference: 
   [http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F#PHP](http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F#PHP)
 *  Thread Starter [James G](https://wordpress.org/support/users/james-g/)
 * (@james-g)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/title-length-1/#post-5141271)
 * Hello Justin
 * I added the code to the functions.php.
    Works like a charm!
 * Thanks

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

The topic ‘Title length’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/dsgnwrks-instagram-importer.svg)
 * [DsgnWrks Importer for Instagram](https://wordpress.org/plugins/dsgnwrks-instagram-importer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/dsgnwrks-instagram-importer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/dsgnwrks-instagram-importer/)
 * [Active Topics](https://wordpress.org/support/plugin/dsgnwrks-instagram-importer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/dsgnwrks-instagram-importer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/dsgnwrks-instagram-importer/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [James G](https://wordpress.org/support/users/james-g/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/title-length-1/#post-5141271)
 * Status: not resolved