WordPress shortcodes are small pieces of code that let you do nifty things with very little effort. They were introduced in WordPress version 2.5 and have been a popular feature since then.

What Can WordPress Shortcodes Do?

Shortcodes can embed files or create objects that would normally require a lot of complicated, ugly code in just one line. They can be used to perform tasks such as:

  1. Embedding Media: Embedding videos, images, or other media files.
  2. Creating Objects: Creating objects like buttons, tabs, boxes, sliders, or responsive grids.
  3. Integrating Plugins: Displaying features from plugins, such as forms or galleries.
  4. Custom Functionality: Any custom functionality provided by your theme or custom plugins.

In essence, they’re a shortcut to complex coding tasks, hence the name “shortcodes”.

How Do Shortcodes Look?

A shortcode is enclosed in square brackets. For example, the WordPress gallery shortcode looks like this: .

Some shortcodes can also include attributes. For instance, .

Some shortcodes can be wrapped around text, acting a bit like HTML tags. These are known as enclosing shortcodes. For example, [shortcode]Your content here[/shortcode].

How to Use WordPress Shortcodes?

To use a shortcode in a post or page, simply enter the shortcode (including the square brackets) in the post editor where you want the result of the shortcode to appear.

If you want to use a shortcode in your theme files (outside the post editor), you can do so with the do_shortcode function. For example, <?php echo do_shortcode("[shortcode]"); ?>.


Shortcodes are a powerful feature in WordPress that allows you to add complex functionality to your site with ease. However, they should be used sparingly, as they can make your content less portable if you decide to switch themes or disable the plugin that provides the shortcode. Also, too many shortcodes can potentially slow down your site. Always check the documentation for your theme or plugins to understand the shortcodes available to you.