21 January 2014

Trim your text in WordPress

A handy little WordPress function that’s been around since WP 3.3 is wp_trim_words(), this little function allows you to easily trim text to a chosen word length and gives you the option to append the text however you like.

How it works:

Example usage:

Read more about wp_trim_words() over at the Codex.