Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Truncate by word or character
<?php
// Trims by word
wp_trim_words( $text, $num_words, $moretext );
// Trims by character (and strips HTML)
wp_html_excerpt( $str, $num_char );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment