Code Element El

Custom WordPress Excerpt Length

You can change the default WordPress excerpt length by using the native excerpt_length filter hook.

/**
* Custom Excerpt Length
*/
add_filter( 'excerpt_length', function ($length) {
    return 20;
}, 999 );