Shortcode
A shortcode is a short tag in square brackets, such as [gallery], that WordPress replaces with content when it shows the page. The plugin that defines the tag supplies the content, so when that plugin is gone the page shows the bracketed text instead.
- By
- WP Ministry
- Published
In short
- A shortcode is a placeholder. The plugin or theme that registered its name produces what visitors see.
- Bracketed text on a live page means nothing on the site answers to that name. The plugin is deactivated or removed, or the name is mistyped.
- Before you remove a plugin, search your content for its shortcodes.
A shortcode is a tag in square brackets that stands in for something code will build. You put [gallery] in a page, and when a visitor opens it, WordPress swaps the tag for a photo gallery. A shortcode can carry settings, written as attributes: [add_to_cart id="99"].
Each shortcode is registered by code under its name. WordPress itself provides six: [caption], [gallery], [audio], [video], [playlist] and [embed]. Every other one comes from a plugin or a theme. Shortcodes arrived in WordPress 2.5, long before blocks, and many plugins now offer a block that does the same job.
Where you meet it
- In a page's content. In the block editor a shortcode sits in a Shortcode block: add a block and choose "Shortcode", or type
/shortcodeand press Enter. In the Classic Editor it is typed straight into the text. - In a plugin's instructions. "Paste this shortcode into a page" is how a plugin, a form plugin for example, puts its output where you want it.
- In a WooCommerce store. WooCommerce built its store pages on three:
[woocommerce_cart],[woocommerce_checkout]and[woocommerce_my_account]. Today it creates the Cart and Checkout pages with its Cart and Checkout blocks, and the My Account page with the shortcode, which has no block yet. An older store may still have the shortcodes on all three.
What goes wrong
The page shows the bracketed text. A visitor sees [woocommerce_my_account] where the account area should be. WordPress swaps only the tags that code has registered and leaves every other one as it is. So nothing on the site answers to that name: the plugin is deactivated, deleted or failing to load, or the name is mistyped. Bring the plugin back, or replace the tag with whatever now does that job. For a store's checkout, see how to fix a WooCommerce checkout that is not working.
Raw tags appear while you test plugins. Switching every plugin off to find a plugin conflict makes their shortcodes show as text. That is expected, and it ends when the plugins are back on.
A plugin you left has tags all over the site. Removing a plugin does not remove its shortcodes from your content. Moving away from a page builder is the common case: switching from Elementor to the block editor shows how to find the leftovers.
The shortcode is there but does the wrong thing. Attributes need straight quotation marks. Curly ones, which come with text pasted from a document, are a common cause. A shortcode inside <pre> tags does not work as expected either.
How to look at yours
To find the content that holds a shortcode, search for the start of its name with WP-CLI:
wp post list --s='[woocommerce_' --post_type=any --fields=ID,post_title,post_type,post_statusIt lists each post and page whose title or content has that text. Change the text between the quotation marks to look for another shortcode.
Common questions
Why does my page show text in square brackets?
The text is a shortcode, and the plugin or theme that defined it is no longer running. WordPress shows a tag it does not recognize exactly as it was typed. Reactivate the plugin, or edit the page and remove the tag.
Are shortcodes out of date?
They still work, and the block editor has a Shortcode block to hold them. Blocks have taken over much of the job: WooCommerce calls its own shortcodes legacy and points to its blocks. Where a plugin offers a block, use it for new pages.
Is it safe to delete a plugin whose shortcodes I use?
Not before you have checked. Each page that holds one of its shortcodes will show the bracketed text to visitors once the plugin is gone. Search for the tags first and replace them.

