order get_posts attachments from media library
-
Where is the mistake? I’m trying to get all the media from the library (works) and order them in a specific way (doesn’t work).
$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null, 'orderby' => ID, 'order' => ASC ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $post) { setup_postdata($post); the_attachment_link($post->ID, false); echo ''; } }
- The topic ‘order get_posts attachments from media library’ is closed to new replies.