WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/wp trim excerpt

Contents

Description

Generates an excerpt from the content, if needed. Must be used inside the "Loop".

The excerpt word amount will be 55 words and if the amount is greater than that, then the string ' [...]' will be appended to the excerpt. If the string is less than 55 words, then the content will be returned as is.

Usage

<?php wp_trim_excerpt$text ?>

Parameters

$text
(string) (required) The excerpt. If set to empty an excerpt is generated. If you supply text it will be returned untouched. It will not be shortened.
Default: None

Return Values

(string) 
The excerpt.

Examples

Notes

Change Log

Source File

wp_trim_excerpt() is located in wp-includes/formatting.php.

Related

the_excerpt_rss wp_trim_words

See also index of Function Reference and index of Template Tags.