Skip to content

Instantly share code, notes, and snippets.

@jgoslow
Last active August 13, 2022 18:09
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 jgoslow/dc41b06977a468ef93a9f0f4ed541bb3 to your computer and use it in GitHub Desktop.
Save jgoslow/dc41b06977a468ef93a9f0f4ed541bb3 to your computer and use it in GitHub Desktop.
Wordpress Excerpt PHP Functions
/**
* Filter the except length to 20 words.
*
* @param int $length Excerpt length.
* @return int (Maybe) modified excerpt length.
*/
function wpdocs_custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'wpdocs_custom_excerpt_length', 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment