WordPress tip: Get rid of unused shortcodes

March 15, 2010 at 8:48 am

WordPress shortcodes are great, but they have a bad point: When you decide to stop using them, their code stay in your post content. Here is a fix: A simple SQL query to run on your database to get rid of unused shortcodes.

Simply run the following SQL query on your WordPress database, using the command line client or PhpMyAdmin. In this example, I assume the unused shortcode is [tweet].
Don’t forget to backup your database before using this query.

UPDATE wp_post SET post_content = replace(post_content, '[tweet]', '' ) ;

If you like to know more about WordPress SQL queries, you should have a look to this article.

Tags: