Customize Excerpt Length

Customize Excerpt Length with a custom snippet.

<?php
/**
 * Customize the excerpt length.
 *
 * @param int $length The default excerpt length.
 * @return int The custom excerpt length.
 */
function custom_excerpt_length($length) {
    return 20; // Change this number to your desired length
}
add_filter('excerpt_length', 'custom_excerpt_length');

Post Comment