var one = [{id: '1'}, {id: '2'}],
two = [{id: '2'}, {id: '5'}],
twoIds = [];
for ( i in two ) {
if ( two.hasOwnProperty(i) ) {
twoIds[two[i].id] = 1;
}
}
for (i in one) {
if ( one.hasOwnProperty(i) ) {
if ( twoIds[one[i].id] !== undefined ) {
one[i].field = true;
}
}
}
$query_images_args = array(
'post_type' => 'attachment',
'post_mime_type' =>'image',
'post_status' =>'inherit',
'posts_per_page' => -1,
);
$query_images = new WP_Query( $query_images_args );
$images = array();
foreach ( $query_images->posts as $image) {
$images[]= wp_get_attachment_url( $image->ID );
}
setInterval( function(){ window.location.reload() }, 100 );