apply_filters( 'wp_trim_excerpt', string $text, string $raw_excerpt )

Filters the trimmed excerpt string.


Description Description


Parameters Parameters

$text

(string) The trimmed text.

$raw_excerpt

(string) The text prior to trimming.


Top ↑

Source Source

File: wp-includes/formatting.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Rachel Cantor

    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.