DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

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.



  1. Few problems with this…..

    1. There are usually dozens and often around a 100 Shortcodes with Themes, thus, this really doesn’t solve the problem.

    2. The real issue is that both coding and writing standards are being violated. First, most shortcodes can easily be simple css/html, thus not requiring a shortcode breaking coding standards. Second, the ones that require more complex functions should simply function as a separate plugin. Third, shortcodes are being inserted in the Text itself, rather than the HTML as they should be (like some of the codes of TinyMCE already does such as the “blockquote”), thus causing more problems copy and pasting, adding unnecessary bulk to the database, requiring more top end code calls, etc.

    Bottom line, the current trend to use shortcodes is a HUGE mistake and problem. A couple for complex things can be useful, and added to TinyMCE as a button, which is inserted into the code rather than the Text itself, while the rest can easily be made into css/html which works exactly the same as the shortcode. Good all around.

  2. I have a plugin that is not playing well with the rest of the gang; without naming names it is a plugin that places amazon links in posts via a shortcode that uses its identifier and the Amazon Product Code i.e. [PLUGINIDENTIFIER=073854972X].

    In a nutshell, it is horking the rest of the post content

    It is a pretty popular plugin and I expect it to be fixed eventually so I am wondering if perhaps a css class (?) could possibly be created to (hopefully only temporarily) hide the unused shortcode?

  3. There is actually a plugin I just found that will take care of this problem :)


  4. You’ve got an error – it should be:

    UPDATE wp_posts SET post_content = replace(post_content, ‘[tweet]’, ” ) ;

Leave a Comment

Your email address will not be published. Required fields are marked *