Removing YouTube and Vimeo Shortcodes in WordPress

Hey there! I'm currently working on a CLI tool to deploy WordPress apps to DigitalOcean. Check it out! It's free and open source.

Quick Tip! If you’ve been using WordPress for a long time you might still be locked in to using a video embed plugin like I was a few hours ago. Yes plugins are great, but these days it’s part of the WordPress core. So how do you get rid of those YouTube and Vimeo shortcodes?

I haven’t found an easy way to do it and yes I’m still frustrated with the shortcodes concept in general, but there are times you simply can’t avoid them. You should be comfortable with MySQL, at least using something like phpMyAdmin to carry out the following query:

<code>UPDATE wp_posts SET post_content =  </code>
    REPLACE( REPLACE( post_content, '[youtube]', '' ), '[/youtube]', '' )
    WHERE post_content LIKE '%[youtube]%[/youtube]%';

And that did the trick for all my 20 posts and pages that included YouTube videos embedded in shortcodes. You can do the same for Vimeo and other services, but this won’t work if you used extra shortcode attributes. You’ll have to do it the hard way, i.e. regular expression search and replace through a MySQL dump file, ugh!

About the author

Konstantin Kovshenin

WordPress Core Contributor, ex-Automattician, public speaker and consultant, enjoying life in Moscow. I blog about tech, WordPress and DevOps.