Skip to content

Instantly share code, notes, and snippets.

@tdrayson
Created October 27, 2020 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdrayson/fd5fc66a01aa272f85de4187ef92af22 to your computer and use it in GitHub Desktop.
Save tdrayson/fd5fc66a01aa272f85de4187ef92af22 to your computer and use it in GitHub Desktop.
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
/**
* Change the length of excerpt.
*
* @param int $length The number of words. Default 55.
* @return int New excerpt length.
*/
function custom_excerpt_length( $length ) {
return 20; // number of words. Default is 55.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment