WPDev.one
Core Function
View Source on Trac ↗

wp_trim_words()

wp_trim_words( mixed $text, mixed $num_words = 55, mixed $more = null )

Trims text to a certain number of words.

Parameters 1 required

Name / Type Description
$text
string

Text to trim.

Required
$num_words
int

Number of words. Default 55.

$more
string

Optional. What to append if $text needs to be trimmed. Default '…'.

Return Value

(string)
Trimmed text.

Function Information

Since Version
3.3.0
Source File
wp-includes/formatting.php
Advertisement