Shortcode Tutorial – Default WordPress Shortcodes

WordPress shortcodes are square bracket strings ([ ]) that magically transform into something fascinating on the frontend.

WordPress comes with 6 default shortcodes.

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

In above list of default shortcodes, some of they are self-closed shortcodes. Some are enclosed shortcodes.

[ audio] Shortcode

The Audio feature allows you to embed audio files and play them back using a simple Shortcode.




[audio src="audio-source.mp3"]

[audio mp3="source.mp3" ogg="source.ogg" wav="source.wav"]

[ caption] Shortcode

The Caption shortcode allows to wrap captions around content using a simple shortcode. This is used with individual images


[caption] <image> Caption [/caption]


[caption id="attachment_6" align="alignright" width="300"]

   <img src="http://localhost/wp-content/uploads/2021/12/sample.jpg" /> Sample Text


[ embed] Shortcode

The Embed shortcode allows to wrap embedded items using a simple shortcode to set of a maximum width and height.


[embed] ... [/embed]


[embed width="700" height="500"] ... [/embed]

[ gallery] Shortcode

The Gallery shortcode allows to add one or more image galleries to posts and pages using a simple shortcode. By using this we can create galleries of images.




[gallery ids="729,732,737,740"]

729, 732, … are image IDs. It will create a image gallery.

[ video] Shortcode

The Video shortcode allows to embed video files and play them back using a simple shortcode.




[video mp4="source.mp4" ogv="source.ogv" webm="source.webm"]

So, here we have seen the detailed concept of default wordpress shortcodes. In coming tutorials we will see how to create our own shortcode and how to use it in wordpress.