This snippet will let you define a new custom default excerpt length for the WordPress excerpts output.
The following example will set the default excerpt length to 20 characters.
Instructions
Add this code to your functions.php
file.
function new_excerpt_length($length) { return 20; } add_filter(‘excerpt_length’, ‘new_excerpt_length’);
function new_excerpt_length($length) { return 20; } add_filter(‘excerpt_length’, ‘new_excerpt_length’); |
Tested with WordPress v. 4.8 |
Last Modified: 15.05.2018 |
Last Reviewed: 15.05.2018 |
How to change the WordPress default excerpt length
4.4 (88%) 15 votes
Please report broken snippets.