What Are Shortcodes in WordPress?

Table of Contents

In WordPress, a shortcode is a tiny bit of code that allows web creators to do various things with minimal effort. So, a shortcode is similar to a shortcut to add features to a site that would typically require high technical ability and complex computer code. 

How Do Shortcodes Work?

WP 2.5 introduced shortcode to enable code to be executed within WP pages, widgets, and posts without directly writing code. The code execution enables creating objects or embedding files directly into a page or post where the user wants them to appear – and doing so with just a single line of code. Many 3rd party plugins also use shortcodes.

A shortcode is written between two square brackets. For example, the [youtube] shortcode can embed any public YouTube video into any post or page. Another example is for embedding a video.

A shortcode can also have attributes. For example, the built-in WP video shortcode can take a src (source) attribute,

WordPress comes with various built-in shortcodes, including the caption, embed, audio, video, gallery, and other functionality. Others can be added by plugins by applying the Shortcode API.


Recommended From Elementor

The Future
of Web Creation. Straight to
Your Inbox.

What Intrests You?


Awsome content is on the way.