You code works where the function the_excerpt is used. It does not work when get_the_excerpt is used, which does not apply the the_excerpt filter. It applies get_the_excerpt instead.
Using get_the_excerpt will cause the filter to apply to both the cases since the_excerpt() uses get_the_excerpt().
Automatically generated excerpt content is a different thing since it is created by a filter on get_the_excerpt that strips the markup.
Related Posts:
- Remove more or […] text from short post
- How can i limit the character length in excerpt? [duplicate]
- How can I create a “Read More” link using the_excerpt() on a static front page?
- 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
- Modify Twenty Fourteen Home Page Content Limit & Add Read More Link
- Custom CSS for full post vs. excerpt (Content Options)
- 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
- How to programmatically bring back “excerpts” field in post editor in WP 3.1+
- 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
- How to get excerpt correctly formatted
- Read More for Excerpt not working
- Twenty Fourteen: Change Read More text
- Read more on the post page itself
- wp_trim_words is trimming by character instead of by words
- printf and _n in this example?
- adjust the_excerpt based on template page
- First letter cutting off in excerpt
- How to display links in excerpt? [duplicate]
- Getting the_excerpt to link to child pages [closed]
- Show read more link next to last word
- the_excerpt – want to modify password protected output
- 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?
- Include post title in readmore link?
- Excerpt using Read More Tag
- Gutenberg is Adding Additional HTML Tags When Grabbing the Excerpt
- How to show post content before read more tag (excerpt) for password protected posts?
- 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 only manual excerpts?
- How to get excerpt of the recent posts
- excerpt display same text
- 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 image in excerpt post. Image not displaying
- the_excerpt() and tag
- the_excerpt is not limiting my post page to 55 words?
- How can style text like this in wordpress
- I want to show post excerpt and cap it at 20 words [duplicate]
- Use get_the_excerpt is returning nothing outside of loop
- Hiding Short Description in Shop Page, WooCommerce
- Creating excerpt with simple “Read more” link
- How to remove excerpt white spaces
- The Excerpt gets page excerpt instead of most recent post excerpt
- making the […] clickable
- Modify excerpt link
- What’s the internal concatenation function for creating Excerpts with WordPress?
- Append Second Link to Read More
- Archive limit the text of the_content
- Twenty Eleven: Home Page, View full post of most recent post & Summary of the rest
- How can I add diffrent editable text fields?
- Get the automatic excerpt from a page created with gutenberg
- the_excerpt() is not trimming at
- Adding specific custom fields (images) to post excerpt
- Excerpts not showing
- “read more” tag for excerpt() won’t show full content
- Keep excerpt from stripping URLs and enable autoembed for youtube ONLY?
- How to add a static text at end of a wordpress permalink
- How to add text before posts
- How do I enable the text editer in my WordPress theme? [closed]
- NextGen Gallery not allowing me to display the_excerpt();?
- How to make an If Else on Excerpt Filter
- Excerpt functions is removing the forward slash on the url
- the_excerpt() doesn’t return the Excerpt field content
- Update Plugin Without Overwriting Custom Settings
- Define excerpt length by inserting read more tag
- Auto Linking Words But Only One Time
- Excerpt filter is adding ” in incorrect place
- Search & Replace trailing strings
- 2 posts same excerpt?
- Edit the excerpt before it is shown
- Is there a html tag filter for the excerpt?
- How can I add more code to this?
- Excerpt is only getting shown for first post
- Post content not showing
- Export Posts in excel [closed]
- 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
- Format main page post excerpt previews
- HTML in excerpt WordPress 6.2.2
- Display Rank Math Meta description at the beginning of single post
- Fix count of lines of excerpt block (or any block)