apply_filters( ‘wp_trim_excerpt’, string $text, string $raw_excerpt )

Filters the trimmed excerpt string.

Parameters

$textstring
The trimmed text.
$raw_excerptstring
The text prior to trimming.

Source

return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );

Changelog

VersionDescription
2.8.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    This disables the attempt to return an automatically generated excerpt in the scenario where one isn’t manually set.

    add_filter('wp_trim_excerpt', 'disable_auto_excerpt', 10, 2 );
    
    // Return only the raw excerpt text if one is manually set.
      function disable_auto_excerpt($text, $raw_excerpt) {
          if ($raw_excerpt) {
            return $text;
          }
          else {
            return '';
          }
      }

You must log in before being able to contribute a note or feedback.