Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Playlist Shortcode

This article is marked as in need of editing. You can help Codex by editing it.

The playlist shortcode implements the functionality of displaying a collection of WordPress audio or video files in a post using a simple Shortcode. This was added as of WordPress 3.9 and is used like this:



The playlist shortcode has several attributes, which are making it possible to alter its output.

The default values for the attributes are:


<?php array(
'type'          => 'audio',
'order'         => 'ASC',
'orderby'       => 'menu_order ID',
'id'            => $post $post->ID 0,
'include'       => ,
'exclude'       => 
'style'         => 'light',
'tracklist'     => true,
'tracknumbers'  => true,
'images'        => true,
'artists'       => true

Possible values

Some values do set others depending on their arguments. Keep that in mind when something does not work.

(string) (Optional) Type of playlist to display. Accepts 'audio' or 'video'.
Default: 'audio'
(string) (Optional) Designates ascending or descending order of items in the playlist. Accepts 'ASC', 'DESC'.
Default: 'ASC'
  • NOTE: RAND won't work here, the documentation that was once here is incorrect, see Trac Ticket #29629
(string) (Optional) Any column, or columns, to sort the playlist. If $ids are passed, this defaults to the order of the $ids array ('post__in').
Default: 'menu_order ID'
  • NOTE: rand (random playlist order) will work when set here
(int) (Optional) If an explicit $ids array is not present, this parameter will determine which attachments are used for the playlist.
Default: the current post ID
(array) (Optional) Create a playlist out of these explicit attachment IDs. If empty, a playlist will be created from all $type attachments of $id.
Default: empty
(array) (Optional) List of specific attachment IDs to exclude from the playlist.
Default: empty
(string) (Optional) Playlist style to use. Accepts 'light' or 'dark'.
Default: 'light'
(bool) (Optional) Whether to show or hide the playlist.
Default: true
(bool) (Optional) Whether to show or hide the numbers next to entries in the playlist.
Default: true
(bool) (Optional) Show or hide the video or audio thumbnail (Featured Image/post thumbnail).
Default: true
(bool) (Optional) Whether to show or hide artist name in the playlist.
Default: true


Generally shortcodes are used by adding them to the content of the post editor.

Basic, with default values:


Changing style to dark:

[playlist style="dark"]

Changing type to video:

[playlist type="video"]

Specifying ids of audio, it's the default, files out of the media library:

[playlist ids="123,456,789"]

Specifying ids of video files out of the media library and changing style:

[playlist type="video" ids="123,456,789" style="dark"]

Source File

The playlist shortcode is located in wp-includes/media.php.


WordPress Shortcodes: [audio], [caption], [embed], [gallery], [playlist], [video]