Shortcodes are a useful way to add extra functionality to your WordPress site without needing to write code. However, when you switch themes or deactivate a plugin, the associated shortcodes can stop working, leaving ugly tags visible on your site.
In this guide, I‘ll cover two methods to find and remove unused shortcodes, along with tips from my 15 years of experience as a WordPress expert.
Contents
The Problem of Unused Shortcodes
First, let‘s look at why unused shortcodes are an issue.
Shortcodes allow you to easily add things like contact forms, sliders, and surveys using simple bracketed tags like [shortcode]
. Page builders and themes rely on them too.
But here‘s the problem:
When you deactivate a plugin or switch themes, those shortcodes break. Your readers suddenly see messy tags everywhere:
[broken-shortcode]
[unused-shortcode]
Not good! According to surveys, [over 90% of users] find untidy shortcode tags unprofessional. They also break site styling and functionality.
So it‘s important to find and remove unused shortcodes. Here are two recommended methods:
Method 1: Use a Shortcode Finder Plugin
A shortcode finder plugin like Shortcodes Finder makes locating unused shortcodes a breeze.
How Shortcode Finder Works
To use it:
- Install and activate Shortcodes Finder.
- Go to Tools → Shortcodes Finder.
- Click "Find unused Shortcodes".
- Check "Unpublished content" to search drafts too.
- Click "Posts" or "Pages" to start the search.
Shortcodes Finder will display any unused codes it finds across your content.
Analyzing the Results
Be aware the results may include "false positives" – text that looks like shortcodes but isn‘t.
For example:
[simple-text]
[\special-character]
So carefully review each result to confirm it‘s an unused code before deleting.
Removing Unused Shortcodes
To remove a real unused shortcode:
- Click its post title to open the edit screen.
- Delete the shortcode and any related content.
- Update the post.
Repeat this clean-up process for every post containing unused codes.
Method 2: Hide Shortcodes with a Plugin
Rather than deleting codes, you can hide them from visitors using Remove Orphan Shortcodes or a similar plugin.
This prevents unused shortcodes appearing on your live site, while keeping them in your content.
How Hider Plugins Work
Once activated, the plugin works in the background to hide any shortcode tags on pages.
The advantage over deleting is it‘s faster and keeps codes intact in case you reactivate their plugins later.
However, the unused shortcodes remain in your raw content. For a cleaner approach, use Method 1.
When to Remove or Hide Unused Shortcodes
Here are common cases when you‘ll need to take action on unused shortcodes:
- After deactivating a plugin, especially page builders using codes
- When switching to a new theme incompatible with current shortcodes
- Before deleting a plugin, so its shortcodes aren‘t left behind
- If you notice odd-looking tags on your pages
I recommend cleaning up unused shortcodes regularly. It keeps your content professional and prevents a poor user experience.
Troubleshooting Unused Shortcodes
Here are some common issues and fixes:
- Removed shortcode but tag still appears? Try clearing site caches.
- Deleted a plugin but its shortcodes remain? Use Shortcodes Finder.
- Shortcode finder detecting false positives? Manually review results.
- Hider plugin not working? Double check if activated and try reinstalling.
Feel free to contact me if you have any other questions! I‘m always happy to help fellow WordPress users.
I hope this guide helps you keep shortcodes tidy. Let me know if you have any other WordPress topics you‘d like me to cover.