Skip to content

Instantly share code, notes, and snippets.

@terrytsang
Last active September 11, 2022 09:58
Show Gist options
  • Save terrytsang/4f96f0eca5617078d56abcee70f75c9a to your computer and use it in GitHub Desktop.
Save terrytsang/4f96f0eca5617078d56abcee70f75c9a to your computer and use it in GitHub Desktop.
change the default length of your excerpts in your WordPress website
<?php
//add this code into your theme functions.php
add_filter( 'excerpt_length', function($length) {
return 20; //edit the number to the amount of words you want to show in your excerpts
}, PHP_INT_MAX );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment