How To Remove Unused Shortcodes From WordPress Content

Shortcodes are really useful and cool to use for WordPress posts and pages. The great thing about WP Shortcodes is that we can easily create custom functions and then call these same functions right inside the post area or even in a widget supporting only html and text. There reaches a time however when we need to get rid of them.

For example when you switch your WordPress theme, some shortcodes will stop to work specially if they are dependent on the previous theme.

Result: Shortcodes being displayed as full text inside your posts. Ugly right? So you can either search across your hundreds of posts and edit them one by one or the the wise solution is to clean the unused shortcodes using a simple and intelligent database query.

Here’s a little WordPress database hack to remove all unused shortcodes from WordPress posts. Just run it from phpmyadmin.

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

Of course, replace [randomquote] with your own shortcode which needs removing. Warning: Make a backup of your database before running this query.

Divi WordPress Theme

Leave a Reply

Be the First to Comment!

Leave a Reply


wpDiscuz