What is: Shortcodes
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:
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 is added dynamically directly into the post or page where the user wants them to appear.