WordPress glossary

Shortcode

Text in square brackets that WordPress replaces with something else.

They are usually used in the content for pages and posts. In the block editor, you add a shortcode with the Shortcode block, and it’s replaced with the content it represents when the page is displayed on the site.

One of the most commonly used shortcodes is the gallery shortcode, which usually looks something like this:

[gallery id="123" columns="3" size="large"]

This shortcode will load the gallery with ID 123, and display the images in the “large” image size and three columns. In the classic editor, you created a gallery by clicking the “Add Media” button, clicking the “Gallery” tab on the left, selecting multiple images and clicking the “Create a New Gallery” button. This inserted a shortcode with the images and settings you selected into your content. In the block editor, the Gallery block does the same thing.

WordPress includes the following shortcodes out of the box:

  • audio
  • caption
  • embed
  • gallery
  • playlist
  • video

Additional shortcodes can be added by your active themes and plugins. Since the block editor was introduced, most of what used to be done with shortcodes is done with blocks instead, but shortcodes from older plugins still work.

Published May 19, 2018

Modified November 24, 2026

Related terms