Back to blog
5 min read Export Guides

Find Every WordPress Post That Uses a Shortcode (Before You Remove a Plugin)

Before you deactivate a gallery, slider or form plugin, you need to know where its shortcode is used. Otherwise the posts that use it start showing raw text like [old_gallery ids="21,22"] to your visitors. WordPress doesn’t keep a list of where a shortcode is used. With Import Export by RockStarLab, one Content filter exports every post that contains the shortcode, and an import with a Replace rule can swap it for another one in bulk. In the example, an old gallery plugin on a coffee roastery’s blog is replaced.

Free: everything in this guide works for posts and pages. PRO: the same for custom post types and WooCommerce products.

Short Answer

  1. In Export, choose Posts and add the filter Content Contains with the start of the shortcode, for example [old_gallery.
  2. Export ID, Title, Status and Permalink to get the list, or ID, Title and Content to fix the posts in bulk.
  3. To replace the shortcode, import the Content file with Check for Existing Items by Field = ID, If Match Found = Update and a Replace links rule. Repeat with Pages.

Find the posts

Search for the opening bracket and the shortcode name, without the closing bracket, so the filter also finds shortcodes with attributes:

Export filter: Content Contains [old_gallery; total items available 4
One Content filter finds every post with the shortcode, drafts included.

Four posts matched. Two things to know about that number:

  • Drafts are included. “Harvest Trip” is a draft with the gallery in it. It isn’t public yet, but it will break when it’s published.
  • Longer shortcode names match too. [old_gallery also found “New Espresso Bar”, which uses [old_gallery_slider, a different shortcode from the same plugin. Check the list before you change anything.

We exported ID, Title, Status, Date and Permalink to XLSX:

Spreadsheet with ID, post_title, post_status, post_date and permalink for four posts: New Espresso Bar, Harvest Trip (draft), Cupping Night Photos and Our Roastery in Pictures
The list to work through before you deactivate the plugin.

Don’t forget pages

An export of Posts doesn’t include pages. Our “Visit Us” page also used the gallery. Run the same filter with Pages, and with each custom post type that could contain the shortcode.

Shortcodes in widgets, menus or theme settings aren’t stored in post content, so this search doesn’t find them. Check those places by hand.

Replace the shortcode in bulk

If the new plugin, or WordPress itself, has a shortcode that takes the same attributes, you don’t have to edit each post. Our old gallery used ids and columns, which WordPress’s built-in shortcode understands too.

  1. Export the same posts again with ID, Title and Content, as CSV.
  2. In Import, choose Posts, upload the file and click Auto Map. ID, Title and Content are mapped.
  3. On the options step, set Check for Existing Items by Field to ID, If Match Found to Update, If No Match Found to Skip, and turn on Replace links.
Import options: Check for Existing Items by Field ID, If Match Found Update, If No Match Found Skip, Replace links rule from [old_gallery ids= to [gallery ids=
A Replace rule swaps the old shortcode for WordPress's own gallery shortcode.

The rule replaces any text, not just links. We used [old_gallery ids= → Import Completed Successfully: 4 successful, 4 updated, 0 created, 0 skipped, 0 failed Four posts updated; the one with a different shortcode kept its content.[/caption]

The result on our site:

  • Three posts now use with the same image IDs and columns. The shortcode block in “Our Roastery in Pictures” stayed a shortcode block.
  • “New Espresso Bar” was in the file and counts as updated, but its [old_gallery_slider] was left as it was. It needs its own replacement or a manual edit.
  • The draft stayed a draft.

If the shortcode has a closing tag, like [old_gallery]…[/old_gallery], add a second rule with Add More for the closing tag. Then run the same export and import for Pages.

Before you import

A Replace rule changes every match in the content of every row. Try it on one or two posts first, back up the site before the full import, and keep the exported CSV: it’s a copy of the content before the change. Deactivate the old plugin only after a new export with the same filter returns nothing.

With an AI agent

An AI agent connected through the WordPress MCP Adapter (see connecting Claude Code to WordPress) can check what’s left before you deactivate the plugin:

Which posts and pages still contain [old_gallery?

In our run after the import, the agent called rsl-ie/export-preview twice with the filter post_content contains [old_gallery: once for posts, once for pages. It returned “New Espresso Bar” with the slider shortcode and the “Visit Us” page, the two places we hadn’t fixed yet.

FAQ

Does the search find shortcodes in drafts and private posts?

Yes. The export includes every status unless you add a Status filter.

Can I remove the shortcode instead of replacing it?

Yes: delete it from the Content column in the spreadsheet, then import the file by ID as above, without a Replace rule.

Will the import change anything else in the posts?

Only the mapped columns are written: here Title and Content. Status, authors and categories stay as they are, and published posts keep their publish date. A draft’s date moves to the time of the import, the same as when you save a draft in the editor.

How do I find posts that use a block instead of a shortcode?

Blocks are stored as comments like <!-- wp:gallery in the content, so the same Content filter finds them.

Get the free plugin on WordPress.org.

Dmitriy
About author

Dmitriy

WordPress Developer with 15+ years of commercial experience. Elite Author on ThemeForest and creator of custom WordPress plugins. Passionate about clean code, performance optimization, and building useful tools for the WordPress community.

JOIN THE CONVERSATION

Comments 0

Have a question or a tip to share? Leave it below.

Leave a comment

Your email address will not be published. Required fields are marked *

We store your name, email and comment to show and moderate it; your email is never published. Spam protection is provided by Cloudflare Turnstile and profile pictures by Gravatar. See our Privacy Policy.


Try the plugin with no risks!

New users get 1 month with access to all premium features. Experience the most powerful WordPress data engine today.

Download Now
Get PRO for FREE