Last active
April 23, 2018 08:17
-
-
Save paulbremer/edb623a8f525bdc43760b1ab8f630175 to your computer and use it in GitHub Desktop.
WordPress - Filter the excerpt length to 20 characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filter the except length to 20 characters. | |
* | |
* @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