This is one way how to get the postmeta of the posts, by joining the postmeta table and fetching the _wp_attached_file meta value.
Try this:
$mydb->get_results( select a.*, thumb.meta_value
from wp_posts a
left join (select b.post_id, c.meta_value
from wp_postmeta b, wp_postmeta c
where b.meta_key = '_thumbnail_id'
and b.meta_value = c.post_id
and c.meta_key = '_wp_attached_file') as thumb
on thumb.post_id = a.ID
where a.post_type="post"
and a.post_status="publish", OBJECT );
Related Posts:
- Optimizing Query used for a Shortcode
- WP MS: How to query over the network
- Multisite posts in categories on network
- find a random blogid across my multisite network that has at least one post published
- WP_Site_Query vs. WP_Network_Query in WordPress 4.6
- Creating a Post form outside of the Admin
- Using $wpdb Class to Pull Recent Comments Across a Network
- How to order by blog ID in this multisite ‘List Blogs’ custom function
- Bootstrapping WordPress MultiSite Outsite of WordPress – No $wpdb
- Retrieving multisite blog IDs, somehow failing to foreach them properly
- Network Plugin Creating Pages for Different Subdomains
- Use WordPress MultiSite (WPMS) with a remote database for each created site
- get_post_meta fails after switch_to_blog
- Update post meta using save_post hook in multisite
- How to display users with posts published between two dates (Sorted by Post-Count) [Multisite]
- WordPress query posts with multiple post_meta data
- Check if current site ID and value exist in WPDB
- Multi-site site nav, wpdb->prepare missing argument
- Can I replace the “Upgrade Network” with SQL query?
- Use $wpdb->get_results with filter based on array
- Get multisite count without php?
- WP DB Location for “Next Post to Create” Index Value
- Run “get_the_post_thumbnail” with a different table prefix?
- Adding an orderby filter, casting postmeta with multiple keys
- Retrieve post data via WPDB class
- WordPress MS wp-admin/includes/post.php error with shortcode generator
- What are options are there to implement a multi language site
- Where is the robots.txt stored for a WordPress Multisite install?
- WordPress Multisite Multiple child theme
- How to map a specific multi-site blog to a folder?
- WordPress Multisite. Can domain be used instead of subdomain?
- Built to scale, or worry later?
- Multisite Subdomains result in 403 Forbidden
- Set subdomains live in a next step
- ID’s being stripped out of editor for Admin user in Multi-Site
- Change management solution for BP-based site?
- How to Structure WordPress for an Organization and its Departments?
- (How) Can I change my Multisite Network to use a different blog as Primary?
- Multisite non www domain gives registration error but should redirect to www.domain.com
- WordPress multisite htaccess
- get_current_site() not returning site name
- Add custom user fields in Multisite USERS page
- WordPress multisite with multiple parent domains
- WP 4.4 – domain mapping for sites within a multisite network?
- Can I use two different domain names with a WordPress multisite network?
- How to disable the default WordPress redirect to non-www URLs?
- Pull post meta with post_query?
- Bulk theme settings in wordpress multisite
- Should I use a multisite installation to achieve a multi-language site?
- Multisite domain naming
- Switch a single site to a multi-site
- migrate a MU sub blog to a single install
- Preferred method of setting user role only works on Main Site in Network
- Register submenu on network menu from the subsite
- new multisite, old db
- Multisite sub-directories IIS 7.5 change media/uploads location
- One Domain, Two Installs of WordPress
- add_rewrite_rule not working in WordPress Multisite
- Activated multisite and added a site, but can’t access it
- Multisite domain mapping breaks CSS
- multisite (MU) Subdomain- only one wordpress install
- Get latest blog post from another multisite blog
- How to remove and disable access to General Settings Page including its link
- Is it necessary to network enable both the parent and child theme for multisite installations?
- How to make multi site with single Database?
- Multi site installation with multiple domains ie(www.exampleone.com, www.exampletwo.com)
- Change Woocommerce languange on a multisite install
- importing data into wordpress db
- Working with Reverse Proxies and Multisite Installation
- Should I use multisite?
- Prevent duplicate pages from being added
- How to clone homepage for multi region site?
- Compare User meta_value with Product meta_value
- How to use the same “wp_posts” table for different subdirectories in the same DB?
- What is the proper way to merge 2 WordPress blog instances
- How to insert a value to decimal type field using wpdb->prepare?
- In Multisite – main site blog post should be display in minisite or subsite
- Multisite WordPress doesn’t work properly on virual hosts
- 2 wordpress, 2 different themes, some pages with the same content
- Installing other applications alongside WordPress multisite subdomains
- Multisite Dashboard not working
- Multisite (with nested paths) wp-admin redirect loop
- network admin pages not linked to correctly
- change database to multisite in localhost
- Woocommerce Membership synchronised accross multisite
- Styles not being applied to multisite setup
- switch_to_blog($blog_id); still writing to main blog
- How to automate adduser (on linux) when add new user site in multisite
- wpdb get_results() returns only 2 rows
- Multisite main theme changes do not show up in child sites
- Multisite Tables the same as Single Install?
- Is there a built in method to protect pages?
- Multisite: Redirect Subsite Administrator to Subsite Home Page, Bypassing Dashboard
- Access from template info of another blog (in the same network)
- Change identical page for every site in multisite
- 4th Network Site Database Errors?
- Maximum Execution Time Exceeded Error while creating New Site in Multisite, Increasing Time Not working
- Moved WP Multisite, cannot access sites
- FromName –> ReplyTo Name wordpress multisite contact form
- Using WordPress multisite is there a way to force HTTPS on specific subsites and not others?