Title: Remove short code from excerpt
Last modified: August 19, 2016

---

# Remove short code from excerpt

 *  [Vcize](https://wordpress.org/support/users/vcize/)
 * (@vcize)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/remove-short-code-from-excerpt/)
 * I’m using the simple video embedder plugin on my site. To embed a video with 
   it, you enter the short code [simple_video]
 * The problem is, if it is near the beginning of my post, then on the main page
   it shows up in the excerpt field as just the raw text [simple_video]. I would
   like to make it either show the actual video, or just strip that text out altogether.
 * I’ve googled this like crazy and there is lots of info but not really any solutions(
   at least not that worked for me). I played with filters a bit but they’re a little
   over my head.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Scott Bressler](https://wordpress.org/support/users/sbressler/)
 * (@sbressler)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/remove-short-code-from-excerpt/#post-1806308)
 * To remove a shortcode like:
    `[media-credit param=value param2="value2"]text 
   you actually want goes here[/media-credit]` You can use the following to your
   functions.php file:
 *     ```
       add_filter( 'the_excerpt', 'remove_media_credit_from_excerpt' );
       function remove_media_credit_from_excerpt( $excerpt ) {
       	return preg_replace ('/\[media-credit[^\]]*\](.*)\[\/media-credit\]/', '$1', $excerpt);
       }
       ```
   
 * I’m not sure how the [simple_video] shortcode works, but you should be able to
   adjust the above to make it work.
 *  [jtrenor](https://wordpress.org/support/users/jtrenor/)
 * (@jtrenor)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/remove-short-code-from-excerpt/#post-1806322)
 * Thank you sbressler, this worked great for my WordPress site.
 *  [isimpledesign](https://wordpress.org/support/users/isimpledesign/)
 * (@isimpledesign)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/remove-short-code-from-excerpt/#post-1806323)
 * legend i had a similar problem great way to do it 😉

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Remove short code from excerpt’ is closed to new replies.

## Tags

 * [excerpt](https://wordpress.org/support/topic-tag/excerpt/)
 * [Short Code](https://wordpress.org/support/topic-tag/short-code/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 4 participants
 * Last reply from: [isimpledesign](https://wordpress.org/support/users/isimpledesign/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/remove-short-code-from-excerpt/#post-1806323)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
