As of WordPress 3.5, as I'm sure you all know, the gallery shortcode generated from the media uploader changed and now includes a list of image IDs.

The gallery shortcode codex page says the following:

"It's important to note that this style of gallery shortcode is not new to 3.5, however it is much easier to generate and manage with the new Media Workflow introduced in 3.5."

Does anyone know what the minimum WP version is, in which this style of gallery shortcode will still work?

  • Do you mean when the ids attribute was introduced?
    – birgire
    Oct 5, 2013 at 13:34
  • @birgire Yes exactly, sorry if that wasn't clear.
    – Shellbot
    Oct 5, 2013 at 14:41

1 Answer 1


The file /wp-includes/media.php, where the Gallery Shortcode is defined, first appears in WordPress 2.5.

It has the id (singular) attribute to refer to the post_parent:

$attachments = get_children("post_parent=$id ...

The ids (plural) attribute appears in WordPress 3.5, and is used to include attachments:

if ( ! empty( $attr['ids'] ) ) {
    $attr['include'] = $attr['ids'];
$_attachments = get_posts( array('include' => $include

PS: I've updated the Codex, now it reads (updates in bold):

Since WordPress 2.5 and up until 3.5, the gallery shortcode [...]
It's important to note that this style of gallery shortcode is not new to 3.5, previously we could use the include attribute.

  • Thanks for this, but just to clarify are you saying that the gallery shortcode has always accepted this ID format?
    – Shellbot
    Oct 5, 2013 at 14:42
  • Answer updated, hope it's clearer now.
    – brasofilo
    Oct 5, 2013 at 14:50
  • It sounds like I might've just misunderstood the part of the codex page quoted in my original question. It sounds like it's saying that the IDs-style shortcode wasn't brand new in 3.5, but maybe it just means the gallery shortcode in general.
    – Shellbot
    Oct 5, 2013 at 14:53
  • Oh, yes, I see the confusion. Updated Answer and Codex again.
    – brasofilo
    Oct 5, 2013 at 14:58
  • Aha! That makes much more sense now, thanks muchly.
    – Shellbot
    Oct 5, 2013 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.