The function the_excerpt()
is only a echo of the function get_the_excerpt()
:
function the_excerpt() {
echo apply_filters('the_excerpt', get_the_excerpt());
}
If you like a fall back for no input the excerpt meta box, then create a text from the content – get_the_content()
. You can use the core function wp_trim_words()
for set the counter for words and easy to set a text from all content.
A example:
$excerpt = get_the_content();
$excerpt = esc_attr( strip_tags( stripslashes( $excerpt ) ) );
$excerpt = wp_trim_words( $excerpt, $num_words = 55, $more = NULL );
Related Posts:
- Get excerpt from $post->post_content
- How to use the_excerpt in a filter hook?
- add_filter on “the_excerpt” only works when post does not have excerpt
- End excerpt at the end of the sentence
- How do I filter get_the_excerpt() but keep all of its functionality intact?
- Buddypress: Edit activity when new blog post [closed]
- Why in archive page doesn´t show read more button with excerpt?
- the_excerpt filter with an empty excerpt
- Access get_the_title() from ‘excerpt_length’ filter
- Give “Read More” precedence over excerpt() word count
- How do I override the_excerpt so that it will display full content?
- the_excerpt filter doesn’t work as expected
- Excerpt is being added above the content, but it should be after it
- run shortcode in excerpt of single custom post type
- apply_filters(‘get_the_content’, $content) + Except
- Trimming a custom field to a length
- Adding html banner to posts
- Apply wordpress filter checking category
- Add Filter – Pass Variable (PHP < 5.3)
- Filter Post Title without affecting screen-reader-text
- Create different flavours of excerpt
- Cutting off excerpt with first sentence
- Auto-generated excerpt with shortcode and read more button/text link
- Read More in the actual excerpt
- is_page_template() doesn’t work with excerpt_length filter
- the_excerpt() does not work with has_excerpt()?
- get_the_excerpt on mobile still displays continue reading
- Custom excerpt_more filter not working when tag is present
- Why does using excerpt_more filter change link location?
- How to remove a filter that is an anonymous object?
- How to add defer=”defer” tag in plugin javascripts?
- No filter of code on switch from html to visual editor, how?
- How to modify posts_where filter only for the search query
- How to wrap oEmbed-embedded video in DIV tags inside the_content?
- How to add filter with 2 args?
- Adding revision support to WooCommerce product content
- Changing text within the Block Editor
- Search content for shortcodes and get parameters
- How Can I Have A URL Changed Based on the Originating URL?
- Is it possible to Hook/Filters Attachment Creation?
- Apply the_title filter to post titles AND backend auto social-sharing plugin, but not nav menu
- Remove classes from post_class()
- Replace a part of url generated by get_term_link
- Error when overriding only some audio shortcode HTML output
- Filter category in WooCommerce shop page to display related sub-category
- Run oembed separately outside the_content()
- Hook Into the_content Filter For JSON API Only [closed]
- Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?
- Removing an action, or dequeueing style – Both not working
- Where is the changelog for 3.5? where is the list of added removed files?
- apply_filters(‘the_content’) – make it ignore shortcodes?
- When does wordpress process <!–nextpage–>
- Remove style `?ver=` from `/wp-admin/upgrade.php`
- Add attribute to script loaded by the theme
- theme_page_templates not working
- Filter custom post type using multiple taxonomy dropdowns
- Add new post with predefined / preset date
- Remove Extra Classes from Post Title
- Building a request processor for multi-page forms, etc using $_GET requests
- What hooks to hook onto for automatic cache clearing
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- Modify Redux Framework Options in Child Theme
- How to allow code block in wordpress comments
- remove_action: how to access to a method in an child class?
- Set default value for “Additional CSS class(es)” for specific block types
- Contact Form 7 Custom Validation Doesn’t Get Called [closed]
- add_filter to wp_nav_menu_objects having no impact
- How to add a filter to the get_body_class function?
- Using add_filter to modify a public function of a class
- How to hide/remove GhostKit component panel in gutenberg block inspector
- WordPress removing slashes from shortcode output
- when use function the_content break
- Filter page title (displayed in browser tab) of wp-login
- How does wordpress add ‘style’ attribute to element
- How do I safely force get_theme_mod() to use a defined get_option(“stylesheet”) value?
- Shortcode / plugin with custom (flexible) output
- Filter “Your latest posts”
- Is it better to use a constant or apply_filter?
- Hide certain product filters from specific product categories
- Hooked into wp_get_attachment_caption to add content to the default description; not working for jetpack slideshow. Why?
- Add an attribute to the root from functions.php with add_filter
- Would like to use hook or filters to customize email templates
- Removing menus from users other than the administrator
- Can’t understand apply_filter logic
- Modify oembed code conditionally
- Add option to query string before get_posts() is called on archive.php
- How can I add a prefix to titles displayed in sidebar using function.php?
- Modify Default URL for /wp-includes/js/wp-emoji.js?ver=4.6.1
- List all image sizes still getting disabled sizes
- Why this remove empty paragraphs from the_content does not works?
- wp_editor customization
- What problems could happen if I replaced add_filter and add_action with the function calling
- posts_results filter function memory errors
- Adding to an array & passing it through do_action/apply_filters
- Loading a sidebar on an Ajax call
- Taxonomy search filters
- How do you disable the verification process of user email changes?
- Modify the third (context) parameter in a filter?
- Better way to change the default password reset url with the woocommerce one?
- woocommerce_coupon_is_valid_for_product not working to exclude specific product tag