Created
November 11, 2020 14:42
-
-
Save jchristopher/4f4f0938b82d05b00924953ceedd3a27 to your computer and use it in GitHub Desktop.
Implement a max length for global excerpt generation in SearchWP
This file contains hidden or 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
<?php | |
// Implement a max length for global excerpt generation in SearchWP. | |
add_filter( 'searchwp\source\post\excerpt_haystack', function( $haystack ) { | |
$max_length = 10000; | |
if ( strlen( $haystack ) > $max_length ) { | |
$haystack = substr( $haystack, 0, $max_length ); | |
} | |
return $haystack; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment