get_the_excerpt хук-фильтрWP 1.2.0

Filters the retrieved post excerpt.

Использование

add_filter( 'get_the_excerpt', 'wp_kama_get_the_excerpt_filter', 10, 2 );

/**
 * Function for `get_the_excerpt` filter-hook.
 * 
 * @param string  $post_excerpt The post excerpt.
 * @param WP_Post $post         Post object.
 *
 * @return string
 */
function wp_kama_get_the_excerpt_filter( $post_excerpt, $post ){

	// filter...
	return $post_excerpt;
}
$post_excerpt(строка)
The post excerpt.
$post(WP_Post)
Post object.

Список изменений

С версии 1.2.0 Введена.
С версии 4.5.0 Introduced the $post parameter.

Где вызывается хук

get_the_excerpt()
get_the_excerpt
WP_REST_Posts_Controller::prepare_item_for_response()
get_the_excerpt
WP_REST_Attachments_Controller::prepare_item_for_response()
get_the_excerpt
wp-includes/post-template.php 431
return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1868
$excerpt = apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 741
$caption = apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );

Где используется хук в WordPress

wp-includes/default-filters.php 200
add_filter( 'get_the_excerpt', 'wp_trim_excerpt', 10, 2 );