Not sure what a bracketed tag is doing on your WordPress page? This guide explains how to recognize shortcodes, understand their attributes, add them to supported content areas, and troubleshoot common problems—without editing PHP or confusing page content with PDF template placeholders.
What Are WordPress Shortcodes and How Do They Work?
WordPress shortcodes are bracketed tags that WordPress replaces with generated content when a registered handler processes them. A handler is the function responsible for producing the result, such as an image gallery. You insert the tag rather than writing the code that builds its output. See the WordPress Shortcode API documentation.
WordPress core includes shortcodes for features such as galleries, audio, and video. Plugins can register additional shortcodes, and themes can supply functionality through their own code. This makes the shortcode’s provider important: a plugin-specific tag depends on that plugin, while theme-provided functionality can disappear after a theme change. Learn more about plugin shortcodes.
How to Identify WordPress Shortcodes and Find Their Source
To identify shortcodes in existing content, look for a name inside square brackets, sometimes followed by settings. For example, [gallery ids=”12,34″] contains the tag name gallery and an attribute named ids. An enclosing shortcode also has a closing tag beginning with a slash. See the gallery shortcode documentation.
Copy the tag name and search for it in the documentation for your installed plugins and active theme. Compare the complete example, supported attributes, and intended placement—not just the name. If you inherited the site, ask its previous administrator which feature originally generated that content.
WordPress Shortcode Syntax: Tags, Attributes, and Enclosing Forms
Read a built-in gallery shortcode
A practical example of WordPress shortcode syntax is:
[gallery ids=”12,34″]
Here, gallery identifies the shortcode, while ids=”12,34″ selects the image attachments to display. Replace 12 and 34 with actual image IDs from your Media Library. The numbers are examples, not images supplied by WordPress; you can find an image’s ID in its URL when opening it in the Media Library. Refer to the gallery shortcode documentation.
Use only supported WordPress shortcode attributes
Attributes are settings written after the tag name. Separate multiple attributes with spaces and use straight quotation marks around values. For example, [gallery ids=”12,34″ columns=”2″ size=”medium”] combines image selection with supported gallery display options. See the Shortcode API documentation.
Attributes are not universal. A setting supported by one shortcode may mean nothing to another. WordPress provides a helper that lets handlers retain recognized attributes and discard unsupported ones, so inventing a setting does not necessarily produce an error—or any visible change. Follow the provider’s documented names and values. The shortcode_atts reference explains this behavior.
Understand enclosing shortcodes
An enclosing shortcode surrounds content with an opening and closing tag. The following example is hypothetical, not a built-in WordPress feature:
[notice tone=”info”]Your message here.[/notice]
In this illustration, notice is the tag, tone is an attribute, and “Your message here.” is the enclosed content. It would work only if a provider registered that name and implemented the illustrated behavior. Whether enclosed content is displayed, formatted, or processed for nested shortcodes depends on the handler; nesting is not automatically supported. Read more about enclosing shortcodes.
Where Can You Use Shortcodes in WordPress?
Posts and pages are the standard starting point because WordPress processes registered shortcodes through its normal content workflow. In the block editor, the dedicated Shortcode block provides a clear place to insert them. See the Shortcode API documentation.
Other locations require more care. Widget areas, template areas, custom fields, and plugin settings do not all process text in the same way. A shortcode works only where the content passes through shortcode processing, and a provider may impose additional requirements. Do not assume every text field supports shortcodes. Check the documentation for the exact location you want to use. The do_shortcode reference describes shortcode processing.
How to Add a Shortcode Using the WordPress Shortcode Block
If you are learning how to use shortcodes in WordPress, start with a draft page and a documented example. The block editor lets you add a Shortcode block through the block inserter or by typing /shortcode. Use this workflow to keep the first test straightforward. See the Shortcode block guide.
- Find a documented shortcode. Copy an example from its provider. For a built-in test, use [gallery ids=”12,34″] and replace the sample numbers with your own image IDs.
- Verify the provider. For a plugin shortcode, confirm that the required plugin is active. The built-in gallery shortcode does not require an additional plugin.
- Insert a Shortcode block. Open the post or page, select the block inserter, search for “Shortcode,” and add the block.
- Paste and configure the tag. Enter the shortcode and change only documented attributes. Check brackets, quotation marks, and any required closing tag.
- Preview the rendered page. Confirm that the expected content appears before publishing. Test any links or interactive elements relevant to the shortcode.
The block holds the shortcode text; the registered handler supplies its output. Adding the block does not activate a missing provider or make an unsupported tag work. The gallery example above uses WordPress’s documented image-selection syntax. For block usage, refer to the Shortcode block documentation.
Using Shortcodes in the Classic Editor and Supported Widget Areas
In the Classic Editor, place a documented shortcode in the post or page content and preview the result. The Text tab can be useful when inspecting the exact characters. For galleries, WordPress documents the shortcode generated by the Classic Editor’s gallery workflow and its available options.
For a block-based widget area, use a Shortcode block if that area makes it available. The classic Text widget also includes shortcode processing. However, support in these locations does not mean every widget, header setting, or footer field will execute a shortcode. Verify the specific widget or field rather than relying on its position on the page. Consult the WordPress widget documentation.
WordPress Shortcodes vs. Blocks and PDF Template Placeholders
When a native block may be easier
A native block can provide visual controls instead of requiring you to edit a bracketed instruction. For example, the Gallery block lets you select images and adjust gallery settings in the editor. If a provider offers both a shortcode and a suitable native block, consider the block when you prefer visual editing—but check that it supports the features you need.
Why PDF placeholders are a separate case
PDF coupon templates can contain bracketed placeholders for information such as a coupon code, value, or expiration date. Documentation may call these “shortcodes,” but describe their use specifically within a PDF template. Their appearance alone does not establish support in an ordinary WordPress page. See the PDF coupon template documentation.
For that separate workflow, see the guide to displaying a coupon expiration date in a PDF gift-card template. Keep template-specific instructions separate from the general page-content workflow explained here.
WordPress Shortcode Not Working? Start with These Checks
The raw tag appears on the page
If visitors see the bracketed tag, first check its spelling and whether its provider is active. WordPress can leave unregistered shortcode names as plain text. Also confirm that you inserted it in a supported location: valid syntax alone is not enough when the surrounding field does not process shortcodes. See the shortcode processing reference.
The shortcode produces no output
Return to the provider’s smallest documented example and check the data it needs. For a gallery, verify that the supplied IDs refer to existing image attachments. An empty result does not necessarily mean WordPress failed to recognize the tag; a handler can have no matching content to return. See the gallery_shortcode reference.
The result ignores your settings
Compare every attribute with the provider’s documentation. Check the spelling, permitted values, spaces between attributes, and quotation marks. Unsupported attributes may be ignored. For enclosing forms, confirm that the closing name matches the opening name and that the provider supports any nested shortcodes. Consult the Shortcode API documentation.
The problem began after a site change
Record what changed and reproduce the issue before changing more settings. Use a staging copy for plugin deactivation, theme switching, updates, or conflict testing rather than experimenting on a live customer-facing site. Back up the site first and change one thing at a time so the result is easier to interpret. Follow the WordPress troubleshooting basics.
A Quick Checklist Before Publishing Shortcode Content
Use these key takeaways as a final review before making the page public. They bring together the registration, syntax, and placement checks covered above and in the Shortcode API documentation.
- Know the source: identify the shortcode’s provider and confirm that it is available.
- Follow documented syntax: use supported attributes and replace example IDs with real values.
- Check the location: verify support for the exact block, widget, template area, or field.
- Respect the context: do not treat PDF template placeholders as ordinary page shortcodes.
- Inspect the rendered result: preview the page and test relevant functionality before publishing.
- Troubleshoot safely: reserve potentially disruptive tests for staging.
Summary
The most reliable way to use WordPress shortcodes is to start with a documented tag, confirm its provider, and test it in a supported content area. Attributes and enclosing forms depend on the handler, while bracketed text alone proves neither registration nor compatibility. Keep your first example simple, verify the rendered output, and add complexity only after the basic version works. For registration details, see the add_shortcode reference.
