If you did not set an explicit excerpt for your post in the post editor, WordPress by default calls wp_trim_excerpt()
to auto-generate an excerpt. This function throws out all HTML tags to make life simple. the_content()
does not do this when it splits your post on a <!--more-->
tag.
If you don’t want this default behavior you can unhook the wp_trim_excerpt()
function and duplicate it with one of your own that does not remove HTML tags. Watch out when you split your text somewhere: call force_balance_tags()
to make sure your excerpt does not end with Some <strong>great news... [Read more]
, because everything after it will be bold too. You will also have to see how this works with embedded content: if you remove some of the tags for a Flash video you also won’t get what you expect.
Related Posts:
- Extract image from content and set it as the featured image
- Check if the user has explicitly set an excerpt
- How to override function in functions.php of parent theme?
- Show Video in Excerpt
- When is wp_trim_excerpt() called?
- Stripping shortcode from custom excerpt function
- Edit the_content function
- Remove images from get_the_excerpt
- Custom page template how to check is_page from functions.php?
- Remove image from post_content on save_post
- display public excerpt for private post
- Make WordPress size and name images for Retina.js
- get_the_excerpt() not returning anything when post has no excerpt
- get excerpt without images
- WordPress function/template tag to get first n words of the content
- Pinterest Integration Using functions.php
- Allow latex in wordpress excerpt
- Allowing SVG uploads in media uploader without plug-in
- Custom excerpt legnths for specific pages
- Unable to get_the_content(); of a post in WordPress via AJAX
- How to filter out shortcode when displaying the_excerpt() in the loop?
- Using “Read More” link with custom excerpt
- How to display post content instead of excerpt
- Automatically wrap multiple images in div
- How can I add text to all posts/pages/categories/homepage etc
- Using Schema with `the_excerpt`
- Display post shortcode content in the sidebar?
- Error when adding excerpt to the content through functions.php
- Custom Post excerpt not working correctly
- Limit length of first excerpt in the loop
- new_excerpt_more link not working properly
- Excerpts are not displayed by a shortcode on category pages
- How to display retweet count and likes in the meta above the excerpt
- Setting a default text for excerpts of a particular category
- Remove links from the_content when using filters wp_trim_excerpt
- If user is logged-in display/hide something
- Excerpt for pages not showing
- The_excerpt() doesn’t parse – how to change that?
- Tags break custom Excerpt function
- How do I pull excerpts from pages?
- WordPress Excerpt – How to remove the first link using functions.php
- Strip div From Excerpt
- How to change value of variable in theme file with functions.php WordPress?
- first paragraph of the_content as meta description
- Adding Read More to Custom excerpts
- Limit number of characters in different excerpts
- Appending „read more” to the excerpt conditionally
- Hide disclaimer from summary excerpts
- What is best practices to move the following code into a function?
- How to make an If Else on Excerpt Filter
- Regex works in regexr, but not if I filter content [closed]
- getExcerpt: Make ellipsis appear only if character limit is reached
- Problem in outputting shortcode
- need help with ‘… read more’ excerpt in functions.php
- Problem in shortcode outputting content
- Excerpt length: get 2 paragraphs
- Check if excerpt is empty at loop-portfolio
- Can’t change excerpt length and more tag
- More link – not text
- How to add an excerpt and read more link to a page?
- Adding a filter to my posts
- Excerpt – First Sentence & Read More
- Integrating custom API for post content into Admin interface & Public Website [closed]
- Trying to get this function to show below the content
- function to show youtube videos within excerpt – if condition and apply_filters
- Missing feature image link function
- What’s the difference between home_url() and site_url()
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- get_template_directory_uri pointing to parent theme not child theme
- How to customize the_archive_title()?
- remove empty paragraphs from the_content?
- What is the “with_front” rewrite key?
- Why use if function_exists?
- How to override parent functions in child themes?
- wp_enqueue_script was called incorrectly
- Add multiple custom fields to the general settings page
- Ajax call always returns 0
- 400 bad request on admin-ajax.php only using wp_enqueue_scripts action hook
- How long does a deprecated function live in core?
- Solution to render Shortcodes in Admin Editor
- How to add a data attribute to a WordPress menu item
- What’s the difference between esc_html, esc_attr, esc_html_e, and so on?
- remove_action on after_setup_theme not working from child theme
- plugins_url vs plugin_dir_url
- Remove type attribute from script and style tags added by WordPress
- How to run a function every 5 minutes?
- Best way of passing PHP variable between partials?
- Upload Multiple Files With media_handle_upload
- How to display custom field in woocommerce orders in admin panel?
- Adding fields to the “Add New User” screen in the dashboard
- Issues with title-tag and document_title_parts
- How do I get the current edit page ID in the admin?
- How to check if a user exists by a given id
- Why isn’t is_page working when I put it in the functions.php file?
- Add tags to the section via functions.php
- Add image size if page template
- How to create a custom order status in woocommerce!
- Remove Actions/Filters added via Anonymous Functions
- Adding a second email address to a completed order in WooCommerce [closed]
- How to load parent_theme functions.php before child_theme?