In this tutorial we will see how to hide or remove the shortcodes of plugins or themes that you no longer use in WordPress, which are mixed with the content.
What are Shortcodes?
Shortcodes are codes that you can place mixed in with the text of a page or post in WordPress, which when executed on the front-end (the website), are magically replaced by something else.
For example, if I type “npost” in square brackets anywhere, instead of displaying that, it’s automatically replaced by the number of posts in my website. The truth is that shortcodes are very useful and flexible, and we can do everything with them.
The Problem of Shortcodes
However, shortcodes are not all advantages. Shortcodes also require quite a lot of system resources, and if they are abused, we will notice it in the performance of our website. So let’s try to limit their use.
On the other hand, we must differentiate WordPress shortcodes from plugins and themes shortcodes. WordPress has its own shortcodes, like “[ gallery ]” or “[ audio ]”, for example. We will always have those, and there will never be any problems.
But plugin and theme shortcodes are quite dangerous, because their functioning depends precisely on those plugins and themes.
What do I mean by this? Well, if we install a plugin or theme that uses shortcodes, and we use them, the day we stop using it, the content we had disappears and the original shortcode is shown again in brackets.
But be careful! Because in many cases many themes (Divi, and 99% of ThemeForest) or plugins (Divi builder, Visual Composer), make use of these shortcodes without our knowledge. And of course, what happens when we deactivate them. You are left with a gibberish of text and shortcodes everywhere.
And that’s a problem, as all of this is indexed in Google, it takes a toll on our SEO and also makes navigation impossible, annihilating any possibility of having a good user experience. To solve this, one option would be to go post by post, page by page, content by content, manually editing and deleting each and every one of them. But of course, this is quite time-consuming. So, what do we do with those shortcodes, and how can we solve it quickly? Well, we have two options: Hide them or delete them.
Hide unused shortcodes
The first option is to hide those shortcodes, so that neither users nor Google can see them, to minimise the impact of deactivating them. This is achieved with the Remove Orphan Shortcodes plugin, which hides all shortcodes that no longer exist.

This plugin is very easy to use. Just install and activate it, and that’s it. All the shortcodes that appear in your content but are not registered by any plugin or theme, will disappear. While this is fine, it’s very convenient and saves us the trouble, it’s still “sweeping the shit under the carpet”, because those shortcodes are still there, in our database, taking up space foolishly. And what’s more, we need an extra plugin to keep everything working. All in all, a bit of a mess. Another alternative option if you don’t want to install that plugin is to do it by code, placing this line in the functions.php file or in your functions plugin:
add_shortcode( ‘shortcode-en-cuestion’, ‘__return_false’ );
Of course, always changing the red letters of “shortcode-in-question” for the shortcode or shortcodes you want to hide. But once again, it’s just another patch. So after installing the plugin or using the code to save the situation quickly, I recommend that you then proceed to remove those shortcodes.
Delete unused shortcodes
This point is a bit more delicate and “surgical” as we must go shortcode by shortcode, and eliminate them. We will achieve this with the Better Search Replace plugin, which allows us to search and replace any text of any content in WordPress. This plugin is designed to replace content, but we can also use it to remove content if we search for a text and replace it with “nothing”.
IMPORTANT: This is a very powerful tool. And you know: “With great power comes great responsibility”. Technically this means that you can make a big mess if you make a mistake, because this cannot be undone. So please, first of all, make a backup of everything.
Once we have everything secured and backed up, we will select ALL the tables in the list (we can do it with Ctrl+A in Windows or Cmd+A in Mac). and we will proceed to the substitution.
So, click on “Run Search/Replace” and a progress bar like this will appear. Once this has been done, we can check the results, and decide whether to accept the changes or not. We have already got rid of that shortcode. Now we just have to repeat the same with the rest of the shortcodes we know, removing them one by one. Once we have removed them all, we can deactivate and remove both plugins, Better Search Replace and Remove Orphan Shortcodes.
Shortcodes are very useful but they also consume a lot of resources, so we should not abuse them.
In the case that we want to do without a plugin or theme of which we were using shortcodes, we must hide them (patch) or remove them (good solution) so that they are not displayed on our website.
We have hundreds of very interesting posts about WordPress, and online marketing. You can learn the differences between Domain and Hosting or another interesting article is how to customize your wordpress control panel. This way you will have everything more organized.
Leave a Reply