Skip to content

Instantly share code, notes, and snippets.

@luisherranz
Last active May 29, 2018 09:07
Show Gist options
  • Save luisherranz/af8f9fbcbfb92e765141f0437fa47ff3 to your computer and use it in GitHub Desktop.
Save luisherranz/af8f9fbcbfb92e765141f0437fa47ff3 to your computer and use it in GitHub Desktop.
<?php
$query = new WP_Query(array(
'post_type' => 'attachment',
'post_status' => 'inherit',
'fields' => 'ids',
'meta_query' => array(
array(
'value' => $file,
'compare' => 'LIKE',
'key' => '_wp_attachment_metadata',
),
)
));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment