What is a Shortcode in WordPress?

You are here: Home » Blog » CMS » WordPress » What is a Shortcode in WordPress?

What is a Shortcode in WordPress?

What is a Shortcode in WordPress? Shortcodes in WordPress are little bits of code that allow you to do various things with little effort. They were introduced in WordPress 2.5, and the reason to introduce them was to allow people to execute code inside WordPress posts, pages, and widgets without writing any code directly. This allows you to embed files or create objects that would normally require a lot of code in just one single line. For example, a shortcode for embedding a video might look like this:


They can also come with attributes. For example, the built-in WordPress video shortcode can take a src attribute:

[video src="video-source.mp4"]

WordPress comes with several that are built in. These include audio, caption, embed, gallery, and video. Others can be added by plugins using the Shortcode API.

Sometimes you may want to use the text of a shortcode in a post. To do this you have to escape it using double brackets. For example, if you want the text of the video shortcode to display rather than an actual video you can do the following:


Shortcodes simplify the addition of features to a WordPress site. Galleries, videos, and various other functionality would require a lot of code editing. By using shortcodes the HTML and other markup are added dynamically directly into the post or page where the user wants them to appear.

Related Link:

How to Update: Automatically create media_buttons for shortcode selection in WordPress

What is a blog?

By |2019-02-08T19:24:38-04:00March 25th, 2018|Categories: WordPress|Tags: , , |

About the Author:

I am a loving father, & husband. I am a computer enthusiast. I have used and enjoyed computers since I was young and I enjoy teaching young minds how to code, because it teaches them how to think. Today with YouTube, and social media garbage our youth are losing the ability to think on their own and solve problems. I believe this is a serious epidemic as kids today dont understand that technology is a tool. This tool is being abused, and its underlying effects are taking its toll on kids behaviour, and learning.