A shortcode is a small piece of code that WordPress replaces with dynamic content when a page is rendered. It lets editors insert complex features such as galleries, forms or custom layouts simply by typing a tag inside the editor. The tag is surrounded by square brackets and can accept attributes to control its output.
Also called: WP shortcode
Why it matters
Clients can add or change functionality without touching theme files or PHP, which reduces the risk of breaking the site and speeds up content updates. This means faster turnaround for marketing campaigns and lower maintenance costs.
How it works
When WordPress parses post content it runs the do_shortcode function, which scans for text wrapped in square brackets. Each recognised tag is matched to a callback that was registered with add_shortcode in a theme’s functions.php or a plugin, and the callback returns the HTML that replaces the tag. The resulting markup is then sent to the browser.
The mistake people make
A common error is assuming shortcodes will work everywhere, such as inside widget text or the block editor without enabling processing. When they are not parsed the raw brackets appear on the page, creating confusing layout and a broken user experience.