Home / admin / Truncate description within categories admin panel
  • How to Truncate description within categories admin panel


    Adding this snippet to the functions.php of your wordpress theme will truncate the description displayed within the categories admin panel to 150 characters. Change the number 150 on line 09 to adjust the number of characters for the category description.

    ( example screenshot ) ( click code to copy )

    wordpress snippet : PHP

    add_action( 'admin_head-edit-tags.php', 'admin_edit_tags' );
    function admin_edit_tags() {
        add_filter( 'get_terms', 'admin_trim_category_description', 10, 2 );
    function admin_trim_category_description( $terms, $taxonomies ) {
        if( 'category' != $taxonomies[0] )
            return $terms;
        foreach( $terms as $key=>$term )
            $terms[$key]->description = substr( $term->description, 0, 150 );
        return $terms;

    ( WordPress codex functions, hooks, in this snippet. )

    category_description, admin_head, get_term, get_terms, add_filter, add_action, _e, wp,
  • Mike

    Thanks Kevin,
    I am a bit of a WordPress noob and was wondering how the snippet could be altered to truncate custom taxonomy descriptions?

    • Mike

      Sorry Kevin, just figured that out. Silly me.

      • No problem Mike glad to hear you got things working.

  • Torbjørn

    Thank you for this. I wonder if it is possible to do the same for the title of the post in the admin panel?

    • Hi Torbjorn ill try and post a snippet soon that will do just that.