I don’t know why, but every time I see a WordPress post cluttered with unused shortcodes it makes me think of a really old dude with tattoos all over him. You know, the kind of tattoos that seemed like a great idea back in the day but look really crappy now and would take a lot of effort to get rid of.
Where do Unused Shortcodes Come From?
In WordPress ecosystem there’s two ways of adding shortcodes — through themes or plugins. Use a theme to do it, once you switch to a new one you have unused shortcodes. Use a plugin, deactivate it and it’s the same thing — unused shortcodes.
Which way is better? Let me make that question easier to answer by quoting WordPress.org Theme Review guidelines:
…purpose of Themes is to define the presentation of user content, Themes must not be used to define the generation of user content…
So, how can you prevent your website from becoming the old guy with tattoos? As long as you keep in mind that functionality (WordPress core, plugins) and presentation (themes) are two different things you should be safe. Hint: you are adding shortcode functionality.
If that wasn’t enough to convince you, here’s something from WordPress Codex Shortcode API page:
Shortcode API is a simple set of functions for creating macro codes for use in post content… It enables plugin developers to create special kinds of content (e.g. forms, content generators)…
Plugin developers! Don’t fall for themes with 300+ shortcodes. You wouldn’t hire a developer because he can play the piano, why would you buy a WordPress theme based on something it’s not supposed to do?
Note: Even if you use a shortcode plugin, once you deactivate it shortcodes would remain sprinkled through your posts, but the thing is that you CAN keep using a plugin long after you have switched to a new theme.
How Can I Get Rid of Unused Shortcodes?
It depends on how bad the situation is. If it’s just a handful of posts that have them, manual removal is by far the best way to do it. This way you don’t need to know exact shortcodes that were used, you just go through the editor and remove them one by one.
If you have unused shortcodes in so many posts and pages that manual removal would make no sense, you might want to try Hide Unwanted Shortcodes plugin. It doesn’t actually delete any shortcodes, meaning you will still be able to see them in post editor, but it does prevent them from being shown to your visitors.
All you need to do is go to plugin’s settings page and enter all shortcodes you’d like to hide. If you’re not sure which shortcodes you used, it’s best to take a look at your old theme’s documentation.
There is, of course, a way to completely swipe all unused shortcodes, but if you’re not a WordPress developer using Hide Unwanted Shortcodes plugin is a much easier way to do it.