Removing unused shortcodes from the post content

In WordPress, we use plenty of plugins, Some of these plugins require us to place a shortcode in the post, like [favourite_posts]. Shortcode may be a good way to add functionality on our site, but when we deactivate the plugin, the shortcode in the post content don’t get removed.

What happens if it is not removed from the content ?

Shortcode will appear in the frontend in its unprocessed form and It will be printed there as it is. eg [favourite_posts]

if we are using shortcode in the places where data portability is not an issue then it’s okay.

Shortcodes may be used in a best way in following cases :

1. Use in Theme templates
2. Use in widgets
3. Use in theme settings

Removing unused shortcodes from the post content
Because we can’t remember each and every shortcode name used in the post content, It’s a very complex job to achieve this, but by the getting lists of active shortcodes and filter the content with this active shortcodes list and which are not exist in the list, remove those shortcodes from the content.

Copy and paste this code to the end of current theme’s functions.php.

1. it doesn’t remove the shortcode permanently.
2. It will remove all content that are quoted between a ‘[‘ and ‘]’ tag.

Remove the shortcode by using database

Replace “shortcodename” with the shortcode you want to remove and run this query in your site database.

But using this way, we can remove only particular shortcodes which name we know and it’s one by one process.

You Might Interested In


  1. iMoqmi says:

    Hello, i use Shortcodes Ultimate in my site, but now i don’t use anymore and i want to delete all the old shortcodes because posts looks terrible. Can you help me about a plugin maybe wich can remove unused shortcodes? my site is

    1. Amit Sonkhiya says:

      Hello @imiMoqmi

      There is no such better plugin to remove unused shortcodes of Shortcode Ultimate. “Can you help me about a plugin…” <= Do you need any help about such existing plugin or need new one or any other query?

      I checked your site and as it's not in English, I am unable to find unused Shortcode text there.

      You can write here as well as contact us at if you wish to stay private.

      Thanks for asking

      1. iMoqmi says:

        Bro thanks for replay, at this moment i use that plugin, but if i find any way to remove all shortcodes from that plugin i mean to deactivate it.

        Here is example: http://www.drenusha. com/kepucet-ikonike-qe-ende-kane-sukses/

        1. Amit Sonkhiya says:

          I checked the link and found that it’s not appearing as usual shortcode code (usually contains brackets). I think that we have to first inspect them how are they appearing and then perform some queries over database or tweaks in code.

          If we can process then let me sure know. Also you can drop us mail at

    1. Amit Sonkhiya says:

      Thank you for asking. That is also done using regular expression & string replace function so we need bit time to create and test code. We will update you soon.


Leave a Reply

Enclose a code block like: <pre><code>Your Code Snippet</code></pre>.