try this
add_filter( 'get_the_excerpt', 'strip_shortcodes', 20 );
or try this edit
echo strip_shortcodes( get_the_excerpt() );
if shortcode is not register with wordpress function add_shortcode
add_filter( 'the_excerpt', 'remove_shortcodes_in_excerpt', 20 );
function remove_shortcodes_in_excerpt( $content){
$content = strip_shortcodes($content);
$tagnames = array('box', 'alert'); // add shortcode tag name [box]content[/box] tagname = box
$content = do_shortcodes_in_html_tags( $content, true, $tagnames );
$pattern = get_shortcode_regex( $tagnames );
$content = preg_replace_callback( "/$pattern/", 'strip_shortcode_tag', $content );
return $content;
}
Related Posts:
- Setting a default text for excerpts of a particular category
- Appending „read more” to the excerpt conditionally
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- Hide disclaimer from summary excerpts
- How to make an If Else on Excerpt Filter
- Regex works in regexr, but not if I filter content [closed]
- Can’t change excerpt length and more tag
- function to show youtube videos within excerpt – if condition and apply_filters
- remove empty paragraphs from the_content?
- Issues with title-tag and document_title_parts
- Set JPEG compression for specific custom image sizes
- Define custom Page Template without its own .php file
- How to reduce original image quality on upload?
- syntax for remove_filter in parent theme with class
- Add body class of category parent
- Show Video in Excerpt
- When is wp_trim_excerpt() called?
- Convert hyphen to underscore in permalinks
- Override parent theme function that is not hooked or in the functions.php file
- Programmatically Add Font-Awesome Icons to Category Widget
- Remove bulk actions based on user role or capabilities
- Remove images from get_the_excerpt
- Removing title from page
- Hide some items from Screen options in dashboard for products
- get_the_excerpt() not returning anything when post has no excerpt
- Adding body class when post contains a specific shortcode
- Replace Archive Widget Link Text
- How to make unique add_filter to the_content of specific page template files – so each template gets its own addition
- Best way to programatically add “rel” attributes to page and post images
- Limit filter upgrader_post_install to a single plugin
- How to update feed only 2-3 times a week (for Feedburner email)?
- Manipulate Output of wp_list_something: select menu instead of li’s
- Show excerpt for only first post in query
- Remove function or filter
- Can’t check if a post has thumbnail adding filter to get_post_metadata()
- Adding HTML to the end of every post with the Block Editor
- How do I add Bootstrap and LESS to my migrated WordPress site?
- Passing values from a widget to a function within a plugin
- Publish/Update post is changing image links from file url to post url
- Is possible add icon in title posts only in specific tag?
- Custom Post excerpt not working correctly
- Replace a menu with widget or a custom template file programmatically
- woocommerce change currency per category [closed]
- new_excerpt_more link not working properly
- Run wp_kses_decode_entities on atom feed?
- Filtering out the #more anchor link that gets produced by
- Can’t filter wp_get_attachment_link
- append to existing parent theme function
- Override the WordPress core function wp_referer_field
- Modify post filter to set custom number of posts per page and exclude child posts
- Make wp_link_pages() suitable for Twitter Bootstrap markup
- How to add custom JavaScript in functions?
- How to edit the Tags within the image file URLs?
- Add_filter when value is no variable?
- How to add_filter html template to middle of content
- Redefine function arguments before rendering
- How to edit classes in body tag?
- How do I pull excerpts from pages?
- Combine embed_oembed_html and oembed_result
- login_headertitle is deprecated since version 5.2.0
- Filter to wp_list_authors
- Strip div From Excerpt
- Native gallery custom html output
- How to change value of variable in theme file with functions.php WordPress?
- The_content and Preg_replace in loaded Iframe [closed]
- first paragraph of the_content as meta description
- How to edit/replace Parent functions.php function in Child Theme to add “Walker” class
- Functions Filter Question [closed]
- Add Adsense code between job listings – wp job manager plugin
- Replace header image on all other pages but home – URL issue
- Any adverse effects of adding apply_filters to a function?
- the_excerpt function not showing image
- WordPress: Highlight search result exact matches
- how can I add filter in specfic field in my website?
- Adding custom social icons to the social media icon block in the Gutenberg editor?
- Customizing the wp_video_shortcode output with add_filter
- How to add HTML into error message
- Removing comment lines from all enqueued js files using a filter function
- How Do I Unhook This Parent Theme Function?
- Allow user only create specific tags
- Child theme remove parent filter in functions
- function replace_text for entire page
- add product thumbnail to checkout page only and include variation name
- Graphic before title – Specific Category
- Which method is more correct for removing WooCommerce Extensions menu item?
- Only seems to be displaying one child when there are supposed to be multiple
- Why might wptexturize have become re-enabled?
- Shortcode to eliminate and replace with
- functions.php filters not applied in AJAX call
- Problem in outputting shortcode
- Settings in functions.php used by a plugin
- How to Add A Rel Filter to All Links?
- Allow tags and attributes in post and pages content
- Override parent theme function that is not hooked or in the functions.php file
- child_of not working while searching
- More link – not text
- How to add an excerpt and read more link to a page?
- Adding a filter to my posts
- Filter to strip unnecessary attributes
- preg_replace specific Text to small latter strtolower [closed]