I am using wp_query to get uploaded medias. Everything is working fine, but wp_query will return the medias with no post attached. This is not what I wanted. How can I exclude the unattached media from the wp_query?
This is my query arguments look like:
$args = array( 'post_type' => 'attachment', 'post_status' => 'inherit', 'posts_per_page' => -1, ); $attachemnt = new WP_Query($args);
Is there any argument that can use for exclude the unattached media in wp_query class?