# Change the Excerpt Length

> Sets automatically generated excerpts to 30 words instead of the default 55.

- Type: PHP
- Runs: Run everywhere
- Category: [Content](https://wpide.com/library/category/content/)
- Tags: content, excerpt
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/custom-excerpt-length/

## Code

```php
add_filter( 'excerpt_length', function () {
    return 30;
}, 999 );
```

## Notes

Manual excerpts are never shortened.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Change the Excerpt Length" 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/
