Use wp_trim_words( $text, $num_words, $more_text )
The first argument is the text to trim, the second is the number of words you want and the third is the truncation text which defaults to an ellipsis.
The function is located in wp-includes/formatting.php line 1920 (v3.3.1)
Related Posts:
- Using wp_trim_excerpt to get the_excerpt() outside the loop
- apply_filters() and the_excerpt are giving unexpected results
- Compare the_excerpt() to the_content()
- How to include line-breaks in the_excerpt?
- How to get the unfiltered excerpt, without […] or auto-excerpting
- Remove “Continue Reading” Link From the Teaser Excerpt Only
- Display Links in Excerpts?
- Modify youtube video size on one page and show another size on different page
- Read more tag shows up on EVERY post
- Issue with enabling formatting in excerpts in WordPress
- limit the words in the post content and add read more link
- Excerpt Word Count
- Limit the_excerpt in the first point (.) of the sentence
- How to show only manual / custom excerpts?
- Excerpts that don’t truncate words
- Spacing within the excerpt
- “Read more” link doesn’t show up when the post length is under the excerpt length
- the_excerpt Read More Filter
- How to get the excerpts of all children pages
- Custom excerpt showing first paragraph (with HTML formatting)
- Regenerate auto excerpts after updating many posts
- Empty excerpt using wp_get_recent_posts
- Remove whitespace before the_excerpt();
- Different ‘read more’ links
- The excerpt: Display text OR image OR video
- How to display only the excerpt in the blog/posts page with Gutenberg?
- Bulk add tag (or any sort of label) to posts who have custom excerpt
- How to correctly limit the content and strip HTML?
- How to display links in excerpt? [duplicate]
- Writing a custom excerpt function
- Getting first 20 words without excerpt
- Change excerpt length of first post
- Display oEmbed in the_excerpt
- Auto Populate Excerpt Field
- Remove Text within Header tags in the Excerpt
- Line in excerpt and max 5 lines
- Show the excerpt in a loop
- Custom Excerpts Per Page
- Excerpts automatically remove paragraph space
- How to apply excerpt length only on front end?
- get_the_excerpt() issues – returns the excerpt twice or not at all?
- Bug in the_excerpt() function
- Excerpt content
- Show excerpts of posts on P2 Home page
- How to change the length of excerpt() method?
- get_the_excerpt without images
- Automatic excerpts
- How to get only manual excerpts?
- How to properly show the Excerpt only if it exists?
- The excerpt doesn’t add Read more
- How to get excerpt of the recent posts
- Problem with viewing single page correctly. (taken half way down the page on click through)
- Limit the size of the post excerpt
- excerpt box not visible
- I can’t modify the ‘Continue reading…’ link of the_excerpt
- get video from content
- Show Excerpts In Twenty Eleven Theme
- How do you edit the html of teaser excerpts
- Show image in excerpt post. Image not displaying
- the_excerpt() and tag
- the_excerpt is not limiting my post page to 55 words?
- I want to show post excerpt and cap it at 20 words [duplicate]
- Split the_content into two parts
- Use get_the_excerpt is returning nothing outside of loop
- How to edit a typo in excerpt?
- My post excerpt does not work
- Creating excerpt with simple “Read more” link
- How to remove excerpt white spaces
- making the […] clickable
- Modify excerpt link
- Reblog WordPress to another WordPress?
- Append Second Link to Read More
- Twenty Eleven: Home Page, View full post of most recent post & Summary of the rest
- How to enable excerpts just on the “Posts page”
- the_excerpt() is not trimming at
- Excerpts not showing
- Keep excerpt from stripping URLs and enable autoembed for youtube ONLY?
- Excerpt being limited too early
- Help needed using wp_trim_words
- NextGen Gallery not allowing me to display the_excerpt();?
- Excerpt of certain page to display on home page
- get_the_excerpt adding unwanted links to output html
- Excerpt functions is removing the forward slash on the url
- the_excerpt() doesn’t return the Excerpt field content
- How to add a new line to an excerpt?
- 2 posts same excerpt?
- Excerpt displays the current page excerpt not one being pulled
- Trimming breaks up markup
- Edit the excerpt before it is shown
- Is there a html tag filter for the excerpt?
- Add rel=lightbox to custom string
- Excerpt is only getting shown for first post
- WordPress Post Format If Statement?
- How to show excerpt field
- Post content not showing
- Need to show post summary in sidebar
- Limited excerpt with readmore
- Remove automatic excerpts only for single posts
- Setting post excerpt length in php wordpress code, Should will help to save DB size?
- Remove the excerpt and “… Read More” from the featured content on the home page with child theme