Filter hook 'wp_trim_excerpt'

in WP Core File wp-includes/formatting.php at line 4033

View Source

wp_trim_excerpt

Filter Hook
Description
Filters the trimmed excerpt string.

Hook Information

File Location wp-includes/formatting.php View on GitHub
Hook Type Filter
Line Number 4033

Hook Parameters

Type Name Description
string $text The trimmed text.
string $raw_excerpt The text prior to trimming.

Usage Examples

Basic Usage
<?php
// Hook into wp_trim_excerpt
add_filter('wp_trim_excerpt', 'my_custom_filter', 10, 2);

function my_custom_filter($text, $raw_excerpt) {
    // Your custom filtering logic here
    return $text;
}

Source Code Context

wp-includes/formatting.php:4033 - How this hook is used in WordPress core
<?php
4028  	 * @since 2.8.0
4029  	 *
4030  	 * @param string $text        The trimmed text.
4031  	 * @param string $raw_excerpt The text prior to trimming.
4032  	 */
4033  	return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
4034  }
4035  
4036  /**
4037   * Trims text to a certain number of words.
4038   *

PHP Documentation

<?php
/**
	 * Filters the trimmed excerpt string.
	 *
	 * @since 2.8.0
	 *
	 * @param string $text        The trimmed text.
	 * @param string $raw_excerpt The text prior to trimming.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/formatting.php
Related Hooks

Related hooks will be displayed here in future updates.