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:
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.
- WP MySQL Console
- WordPress SQL Executioner
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