Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

You can always filter on the client side:

var query = wp.media.query();

query.filterWithIds = function(ids) {
    return _(this.models.filter(function(c) { return _.contains(ids, c.id); }));
};

var res = query.filterWithIds([6,87]); // change these to your IDs

res.each(function(v){
    console.log( v.toJSON() );
});

Disclaimer: found the beautiful filterWithIds function in this SO questionthis SO question.

You can always filter on the client side:

var query = wp.media.query();

query.filterWithIds = function(ids) {
    return _(this.models.filter(function(c) { return _.contains(ids, c.id); }));
};

var res = query.filterWithIds([6,87]); // change these to your IDs

res.each(function(v){
    console.log( v.toJSON() );
});

Disclaimer: found the beautiful filterWithIds function in this SO question.

You can always filter on the client side:

var query = wp.media.query();

query.filterWithIds = function(ids) {
    return _(this.models.filter(function(c) { return _.contains(ids, c.id); }));
};

var res = query.filterWithIds([6,87]); // change these to your IDs

res.each(function(v){
    console.log( v.toJSON() );
});

Disclaimer: found the beautiful filterWithIds function in this SO question.

Source Link
montrealist
  • 3.1k
  • 1
  • 22
  • 27

You can always filter on the client side:

var query = wp.media.query();

query.filterWithIds = function(ids) {
    return _(this.models.filter(function(c) { return _.contains(ids, c.id); }));
};

var res = query.filterWithIds([6,87]); // change these to your IDs

res.each(function(v){
    console.log( v.toJSON() );
});

Disclaimer: found the beautiful filterWithIds function in this SO question.