Support » Fixing WordPress » attachment from media library

  • I have this problem getting the post_attachment. This attachment is an image from media library and I attach it to another post. So to say using this helper function

    $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => null, ‘post_status’ => null, ‘post_parent’ => $post->ID );

    $attachments = get_posts($args);

    it returns nothing. This is maybe because the image that I attach is already assigned to another post, so meaning it has already post_parent assign to it.

    using this helper function..

    get_children( array(‘post_parent’ => get_the_ID(), ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order ID’) )

    returns nothing also.

  • The topic ‘attachment from media library’ is closed to new replies.