4 Ways To Delete Remove or Disable Shortcodes

If you’ve ever changed themes or plugins which use shortcodes you most probably will be left with unused shortcodes on your pages and posts.

Example: [table “style_35” not found /]

Rather than hunt them down manually, there’s a better solution to remove unused shortcodes quickly & easily.

Caution: Always create a full backup of your databases before executing database queries. You can do this be exporting a copy in PhpMyAdmin or downloading  a copy from cPanel.

You’ll find PHPMyAdmin offers a field for databases queries.

Enter this code and simply replace the example shortcode with the text of the shortcode you want to remove.

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

Navigate to cPanel > Databases > PhpMyAdmin and click the link to the database you want to execute a command in in the left hand sidebar of PhpMyAdmin.

Click SQL on the top menu once inside your database then enter the command code into the box and click the Go button which looks like this:

Run SQL queries on database

Another option to use when executing SQL databases queries is to install a plugin.

There are several plugins which have been built from a stripped down version of PhpMyAdmin and turned into plugins.

These plugins enable you to execute SQL database queries from your WordPress dashboard rather than login and use PhpMyAdmin.

  • RunSQL
  • WP MySQL Console
  • WordPress SQL Executioner

Disable shortcodes

Rather then remove unused ( Naked ) shortcodes manually or by using a SQL query in phpMyAdmin, you can prevent them from showing in your posts by adding 1 small line of PHP code to your functions file.

The following code snippets enable you to deactivate specific shortcodes or disable all shortcodes from working.


External Resources https://codex.wordpress.org/Function_Reference/add_shortcode


Comments

2 responses to “4 Ways To Delete Remove or Disable Shortcodes”

  1. James Gunn Avatar
    James Gunn

    Hi Brad,
    Thanks for this – groping around in the bowels of the earth of my site is a bit daunting, but I got rid of the offending shortcodes eventually. I tried using the RunSQL plugin but this seemed to introduce some syntax errors – some spurious kept appearing in error messages, so I went straight to the MyPHPadmin and had a try. Since I have changed my database prefixes (my security plugin did it really) I had to change the wp_post term to the right table name. Hope other users find my experience useful and feel as technically competent as I now do ! (until the next time :-DI
    Thanks
    James

    1. Brad Dalton Avatar
      Brad Dalton

      Glad you got it fixed James.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.