$images = $wpdb->get_col("
SELECT ID FROM $wpdb->posts
WHERE post_type="attachment"
AND ID in ($meta)
ORDER BY menu_order ASC
LIMIT 5
");
Like @Kaiser suggested you can specify a range (5th to 20th results, a total of 15 results are returned at max) like this:
$images = $wpdb->get_col("
SELECT ID FROM $wpdb->posts
WHERE post_type="attachment"
AND ID in ($meta)
ORDER BY menu_order ASC
LIMIT 5,20
");
Related Posts:
- Turn a URL into an Attachment / Post ID
- Delete Associated Media Upon Page Deletion
- Delete post with all files attached to it
- Is it possible to Schedule Attachments in WordPress?
- what types of order can I pass to get_posts() via orderby?
- Find the post an attachment is attached to
- media_handle_upload for local files?
- How do I detach images from posts?
- Use an attachment in multiple posts
- delete post also attachments
- Replacing all attachment links in post with media file link
- Get post id by attachment id?
- How can I export WordPress posts’ attachments?
- How to remove images from showing in a post with the_content()?
- How do I create Comma Separated list of attached image ids?
- Get post embedded image caption
- post_parent is 0 when uploading new files
- Easy way to delete 70k posts and attached media?
- How to access featured image?
- Load post attached images on a single page site with fancybox
- Insert woocommerce products programmatically with featured image and gallery
- Add the description field on the attached media
- Set size for attachments
- I have a site where attachments in the wp_posts table have guid values of guid, how did this happen?
- Get all attachment by post excluding featured and content inside
- Prevent Delete Attachment by URL or When Submit
- Posts and Attachments with “Published” status in Search
- Get attachments for posts that belongs to a specific category
- Automatically attach image to post if they have the same title
- Get Image tag from content of post
- Can’t update old posts 3.5.2
- How would one change the default url structure of attachments?
- Get attachments only for this post
- Upload attachment from external site
- Reinstall WordPress while keeping attachments
- Get images from the post
- How To Download WordPress Audio Attachments
- How to get the next and previous image title from attachment or gallery?
- All images on one line for each post
- How do I assign an attachment to a post using only the REST API?
- Unable to delete attached file from folder programmatically
- How to convert attachment pages to Posts?
- Get post attachment with post id
- Delete attached images from posts
- Unable to get all the Posts Attachments
- Add in the url attachment loop the wp_link_pages of the post
- Stop images from being displayed on the front-end of the site
- How to get images only attached from edit post page
- How to prevent people from seeing an attachment to a scheduled post that’s released in future?
- How can I get a comment ID on Submit?
- Bulk Attach Or Insert Media To Post Without Opening Post Editor
- Post Attachment missing head (stylesheets/js/what-not)
- Create post from form with image
- Get Video Attachment to post
- how to edit attachments?
- Broken images after importing posts and opening in Gutenberg
- How do you add Read more … link to posts?
- Get current menu_order
- Setting Custom Sort Order of Posts within a Category
- Display post number not post ID number
- has_archive=false on the default post type
- Change slug with custom field
- adding a custom css class to post
- get_post_type_archive_link(‘post’) returns current category archive
- Adding variable for post title so post template can include auto-generated link to view on external website.com/{post title}
- When I re-save a post with [code] sections, the entities are double-escaped (> becomes > etc)
- How can I write comments/hidden text in a post?
- Getting category posts from a certain year
- custom post scheduler for drafts
- Ajaxify This Code
- How do I display some posts fully on the homepage, and some as an excerpt only?
- How to bulk add vast amounts of posts
- 301 (static page instead latest posts)
- Saving custom fields to a custom taxonomy
- Show posts count for Categories and Tags in wp_nav_menu
- How to get subcategories from category slug?
- Conflict array_splice on loop and query in widget
- How come this loop is not working? [closed]
- Change default post style to columns
- Link from Post to Another Post Via Clicking on Words within Original Post
- What’s a theme that properly handles previews of different types of posts?
- A better code for no post format?
- How to create a clickable latest posts list?
- Tag for custom post type
- how to put post customized in page
- How to display particular categorie’s post which associated to specific user?
- Post title spoiler how?
- how to print total number of posts filtered by category?
- How to display post excerpt beside post list inside Post of Dashboard
- Add a unique meta desciption
- Displaying a specific sub-category’s posts from wp_query
- Filter question list on substring of metavalue
- Comment Authors of Post On Front Page
- Make a custom URL and link to custom Template
- How to get all post titles starting with numbers and symbols?
- How to inject a post within a loop
- How to display a certain template element only for posts published within certain time range?
- Wp_query WooCommerce products
- No matching template found when using single.php
- How to automatically convert a form with HTML link into post