Use wp_trim_words()
wp_trim_words( get_the_content(), 20 )
As you’re outside the main loop
wp_trim_words( $recent[ 'post_content' ], 20 )
If you want to apply the same filters as to the_content()
in the main loop
wp_trim_words( apply_filters( 'the_content', $recent[ 'post_content' ] ), 20 )
Related Posts:
- limit the words in the post content and add read more link
- How to get excerpt correctly formatted
- How to correctly limit the content and strip HTML?
- Gutenberg is Adding Additional HTML Tags When Grabbing the Excerpt
- Split the_content into two parts
- Remove more or […] text from short post
- How can i limit the character length in excerpt? [duplicate]
- How to include line-breaks in the_excerpt?
- How to control manual excerpt length?
- excerpt in characters
- Remove Ellipses from Excerpt
- the_excerpt() or get_the_excerpt with shortcode escape
- Custom Excerpt is returning 52 characters and not 52 words
- Disable WYSIWYG rich text editor only on post excerpt
- How to remove “Read on” content in the_excerpt?
- excerpt_length not working
- Read more does not show up when I write my own Excerpt
- can hyperlinks be displayed in excerpts?
- Making oEmbed work on the excerpt field
- Read More for Excerpt not working
- Twenty Fourteen: Change Read More text
- wp_trim_words is trimming by character instead of by words
- Extremely slow pageload for long post when using the_content?
- adjust the_excerpt based on template page
- How Can A Plugin Hook Itself To the End of Every Excerpt?
- How to show video from specific category on sidebar?
- First letter cutting off in excerpt
- the_excerpt(), get_the_excerpt() and the_content() all killing “the Loop”
- How to display links in excerpt? [duplicate]
- Getting the_excerpt to link to child pages [closed]
- Show read more link next to last word
- Excerpt – add the last few words of posts to the […]
- excerpt – don’t use main content if empty
- Any way to get more space for editing post excerpts
- Show validation warning if no Excerpt is added
- Remove box character after excerpts. Special Character Bug
- Where is the logic that defines the excerpt?
- How to have a “clean” post content, for excerpt and social networks sharing
- Excerpt_length nor the_excerpt not working correctly
- How to remove first three words from content and display the excerpt
- Why is my excerpts not showing if not explicitly declared?
- How to get the nivo slider to show excerpt [closed]
- Add “Excerpt” in “Quick edit”
- How to wrap “Read More” link in a DIV tag?
- Problem on the_excerpt(); function
- how to get excerpt without p html tag from wordpress post
- the_excerpt not displaying
- excerpt display same text
- Giving the_excerpt in the place of the_content?
- Post excerpt in custom meta box… help with proper php format
- PHP Code in excerpt?
- Searching for themes that post full article on home page by default
- Limiting the number of characters in the except
- Private Post BUT Public excerpt on Homepage
- Replacing the ellipsis with three dots
- Why is get_the_excerpt returning full content
- The Excerpt gets page excerpt instead of most recent post excerpt
- content and excerpt not displaying
- Make only the image an anchor link using the advanced excerpt plugin?
- Manual excerpt length on recent posts slider
- Remove ‘read more’ link when post is shorter than excerpt
- truncate post with gallery tag
- Removing the […] from the excerpt returned by get_the_excerpt() only in some places
- Excerpt not alway available
- Continuum Theme – Excerpt length
- Prevent Advanced Excerpt from Being Called
- how to include page content to specified length & then “read more” link
- Problem in replacing the_content with the_excerpt()
- “Continue reading” not on some posts, full excerpts not shown
- How to limit wordpress the_excerpt() dynamically
- Read More excerpt link on a post is not linking to the post itself
- Relia Theme Homepage Articles Excerpt displays the current page excerpt not the posts being pulled
- get_the_excerpt only returns one excerpt
- How to extract an excerpt from a specific page?
- Display Full Content Instead of Excerpt
- How to use limit post content on archive page in WordPress?
- Remove Default Read More Link in Manual Excerpt RSS Feed
- How to custom excerpt?
- Unable to show excerpts
- Modify Ixion Theme to Include Post Excerpt On Main Page
- modify text at the bottom of excerpt editor
- excerpt button not going to custom post page
- Excerpt preview
- Excerpt “Read More” link
- Force authors to use Manual Excerpt in WordPress and multiple Manual Excerpts
- Manual excerpt being ignored on custom post type
- Remove “[ ]” from excerpt in highlight search term
- Trimming breaks up markup
- WordPress excerpt with formatting and allowing selected tags
- multiple excerpt length and styles
- how to use the_excerpt for two post queries?
- Way to show content of a post, but if exceeds character limit revert to excerpt?
- Excerpt Problems
- Function to shorten string without cutting off last word
- Implementing a blog excerpt in custom theme
- Get the excerpt of post_content
- Get a raw value of excerpt
- Excerpt length and alignment [duplicate]
- Opening file, editing, save, exit, open, edited version opens?
- Is there a way to display the ‘Read more’ link if it’s within a range?