Skip to content

Instantly share code, notes, and snippets.

@Nessworthy
Created October 27, 2014 11:49
Show Gist options
  • Save Nessworthy/6f4dbc1a4303189acf2f to your computer and use it in GitHub Desktop.
Save Nessworthy/6f4dbc1a4303189acf2f to your computer and use it in GitHub Desktop.
Check all WordPress Media Items not attached to a post/page.
/**
* Must be viewing the media library of a WP install.
* Media library must be in list view.
* Will highlight checked items in yellow. PLEASE CHECK TO MAKE SURE THAT THOSE ARE THE ONES YOU WANT.
*/
var $ = jQuery;
$('#the-list')
.children('tr')
.filter(function(){
var d = $(this).children().filter(':nth-child(5)');
if(d.text().match(/Unattached/)) {
return true;
} else {
return false;
}
})
.css('background-color', 'yellow')
.find('input[type=checkbox]')
.prop('checked', true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment