# Word Count Column for Posts

> Adds a Words column to the Posts list showing the approximate length of each post.

- Type: PHP
- Runs: Admin only
- Category: [Admin](https://wpide.com/library/category/admin/)
- Tags: columns, word-count, posts
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/word-count-column/

## Code

```php
add_filter( 'manage_post_posts_columns', function ( $columns ) {
    $columns['wpide_words'] = 'Words';

    return $columns;
} );

add_action( 'manage_post_posts_custom_column', function ( $column, $post_id ) {
    if ( 'wpide_words' !== $column ) {
        return;
    }

    $text = wp_strip_all_tags( strip_shortcodes( (string) get_post_field( 'post_content', $post_id ) ) );
    echo esc_html( number_format_i18n( str_word_count( $text ) ) );
}, 10, 2 );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Word Count Column for Posts" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
