I am new to WordPress. I have created a template page where I want to show single posts, So to get media of that post I am using a function
$args = array( 'post_type' => 'attachment', 'post_status' => 'inherit', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent__not_in' => array(0) ); $attachment = new WP_Query($args); $attachment = $attachment->posts;
but by this function I am getting all the media images and when I edit the post and remove these images and add new other images.
This function always give me every image, like it always gives all the images old removed and currently added. I need only current images not removed.
Is there any function that give me the current images of the post not removed?