Sure thing my friend, you see, the function “the_excerpt” (located at “WORDPRESSINSTALLDIR/wp-includes/post-template.php”) is the one that makes the echo:
function the_excerpt() {
echo apply_filters('the_excerpt', get_the_excerpt());
}
so, what you want is to use the same function “apply_filters” without the echo:
$myexcerpt = apply_filters('the_excerpt', get_the_excerpt());
…and there you have your excerpt.
Related Posts:
- Allow HTML in excerpt
- Limit the Excerpt field in WP-Admin in words
- Limit the_excerpt with max of x characters
- Remove at the beginning of the_excerpt() with str_replace
- Automatic Excerpt Not Working
- Trim first 2 words of the exceprt
- Extremely slow pageload for long post when using the_content?
- How to change / delete product short description in Woocommerce
- Why does running get_the_excerpt() when generating JSON file take 28 seconds vs. 599 milliseconds without it?
- Excerpt unwanted text “”
- Word Count Function Preventing Permalink Editing
- Custom excerpt function re-factoring
- How to Display a Single Post Excerpt
- How to remove the excerpt in the Dzonia Lite theme
- How do I Add HTML to the_excerpt() & the_content() Output?
- Mass update excerpt
- How to put “Read more” link in Custom Excerpt inside p tag?
- Error when adding excerpt to the content through functions.php
- HTML tags not showing in excerpt
- Query Pages and post excerpts dynamically
- My custom get_the_excerpt() can’t get excerpt by ID
- Adding Meta Tags to a Post using its Tags, Excerpt and content
- Using the_excerpt() on a page
- How to show an entire post content and not also the excerpt?
- stripping tags from excerpt in WordPress is not working
- Almost Done… Post Format Code
- Automatic excerpt is not shown with the_excerpt() command
- Remove   from the_excerpt
- Shortcodes showing in excerpt despite using strip_shortcodes
- How to remove the space before the ellipsis in excerpt?
- Need help removing […] after excerpt
- Post class only applying to first excerpt; why?
- Assign Custom classes to every Excerpt
- Problem in replacing the_content with the_excerpt()
- Find and print first entry from WordPress post in custom excerpt?
- Cannot figure out how to add a read more link to a manual excerpt. Please help
- Trying to modify content.php
- How to trim content AND retain HTML?
- How to apply filter
- Add point on excerpt post
- Archive page if else not working for post_excerpt and post_content
- Creating a function that sanitizes the custom metabox excerpt
- How can I add more code to this?
- Merging two excerpt functions to work with conditions
- I can’t seem to get excerpts showing inside get_pages and don’t know why?
- Excerpt all post content Content Same Size without word cutting off
- Remove post image caption from post_excerpt();
- generate excerpt from the part of big text dump that contains keyword
- dbDelta support for FOREIGN KEY
- How can I save a multiple select array with the settings API for a plug-in options page?
- Inject post (from specific category) between posts in Loop
- Place page title in header?
- Gutenberg Blocks doesn’t render correctly when using do_blocks
- PHP Script within wordpress theme
- How to display product cropped thumbnail (150×150) for WooCommerce product categories
- Add to checkout total lines an additional line below shipping in WooCommerce
- wp_embed_register_handler to embed html files
- When is is_admin() available?
- Creating new menu item
- Processing a subscription form with POST method?
- Get posts with at least one category in common with current post?
- If post ID has_term?
- Apache /Ubuntu server not running WordPress installation, outputting PHP code like HTML
- How to give new users two specific user role options upon WordPress user registration
- add element with add_action to posts from a specific category ID
- developing a wordpress plugin, have a few PHP Woocommerce related coding questions
- How to pick the default selected value in wordpress dropdown?
- How to target grandchild of post_parent using wp_list_pages
- remove post that has no content
- Find a way to retrive data updated through metabox plugin to web page
- Should i use the wordpress Options table or to create database table..?
- Where are the src and srcset sizes coming from?
- wp_remote_post empty $_POST
- Need help with pagination
- Adding Additional Variables on Menus Page
- Querying for specific tags
- Timber right sidebar in WordPress theme
- Build A Custom SQL Query for WordPress Search
- Get main parent category for post (WordPress/Advanced Custom Fields)
- How to run complex query using PHP
- Store ajax data in PHP variable
- How to edit post meta data before publishing the post it self wordpress?
- Call jQuery function from PHP?
- remove_action() not working in page template – Genesis
- Adding action item to admin users table and sending email
- Metabox – Displaying the Value of a Metabox
- Using get_the_excerpt in edit-post
- WordPress – custom navigation item classes
- Is there a way to randomize and connect a background and header image?
- Post Thumbnail on Single (if elseif else)
- dynamically filter by category via sub-menu
- Sidebar doesnt get updated?
- Edit the Publish Widget Options
- If the_content’s string length is greater than 0, show post otherwise dont
- WordPress post pagination on custom template not working
- get_option(‘admin_email’) not working in wordpress when using ajax call
- How do I update product shipping using PHP in WooCommerce?
- Why can’t I enter the wordpress admin interface?
- base64_encode conflict with convert_smilies in wordpress
- PHP $_SESSION array – only showing current index