I am trying to retrieve all the images from the
Gallery of a page in the order they are set in the backend.
So far I have:
$my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query( array( 'post_type' => 'attachment', 'post_parent' => 54, 'post_mime_type' =>'image', 'post_status' => 'inherit', 'posts_per_page' => '20' 'orderby' => 'menu_order', 'order' => 'ASC' ) ); var_dump( $all_wp_pages );
But this seems to return all the attachment images in the standard/default order rather than the order I have dragged and dropped the images in the backend edit gallery interface.
I believe this might be due to the fact that I am querying all attachment images of my page rather than specifically the Gallery, and as such the sorting information for the gallery is not passed in the returned array.
Can anyone tell me how I get all the gallery images of a certain page_id in the order they are set in the backend? There will only be one gallery per page if that helps.