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
- Site Redirecting to wp-signup.php
- Are nested subdomains possible with a subdomain multisite?
- Querying posts from multiple sites in a network?
- is_front_page() malfunction?
- How can I diagnose a slow WordPress admin?
- How to enable a site administrator to edit users in a WordPress network/ multisite setup?
- BLOG_ID_CURRENT_SITE vs. SITE_ID_CURRENT_SITE in WordPress Multisite?
- Shared table across network
- Turn off ms-files.php after network setup
- Opinions whether to go multisite VS 3 separate WP installation [closed]
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- Multisite: differences between subdomain and subdirectory mode? Can it be switch after installation?
- Ban SiteNames Multisite
- WP MultiSite API – Create new sites
- Multisite – how to remove the root ‘/’ site?
- How do I fix problems with users not being able to publish and only submit for review after upgrade of Multisites installation?
- WordPress multisite with domain mapping and virtual host on local with fake domain
- Multiple blogs, different domain names, one install to rule them all
- Can simple Admin save options in a Multisite?
- Is there a hook or a function for multisite blog deactivate or delete?
- How does WordPress tell which post is from which site in a multisite setup?
- How to remove nodes site wide from the toolbar on multisite install
- Limit multisite/network site names to a property of the user
- How to set Active plugins as the default screen?
- Global searchin multisite but only with one subsite
- Hosting a seperate wordpress project on localhost
- Speed up MU WordPress on Apache VPS?
- How do I use different URLs in a single WordPress installation?
- Removing a wordpress multisite installation and preserving the database before migrate to nginx
- Add additional non-rewrite .htaccess directives on multisites via mod_rewrite_rules filter
- get_post_type_object() does not work with switch_to_blog()
- How to change the parent Domain Name in Multisites Project?
- Multisite registration problem [closed]
- Some PDF files get Forbidden Access and other open normally on the same directory subsites
- WordPress MultiSite Theme
- Multisite, Subdomain, shared NFS directory Linux HELP
- Create Custom Multisite User Role to Reduce Capabilities
- How to get blog_id of an MU site when running a custom function on the parent site
- WordPress multisite domain
- WordPress multisite not work wp-admin
- PHP -> SQL Query with Summing
- How to install seperate theme on certain page
- Using Same User Database on Subdomain
- Custom Query: query by post custom meta data
- Permission warning in wordpress multisite
- Static directories in a WordPress multisite network
- Trying to Decide Between Reverse-proxy and Multisite
- Export / import
- Remember language choice on multisite website
- wp-cli core install –skip-email and –skip-config flags not working on MAMP unknown parameter
- Multisite network subdomains doesn’t work
- MULTISITE: Password issue and Error Cant access site
- SSL for Mapped Domains with WordPress Multisite on AWS
- Accessing WP multisite via IP instead of domain
- Running hosted multisite version of wordpress
- Applying Child Theme to another site, which has its own URL
- How to implement this subdirectory mapping in multisite?
- WordPress MU with subdomain
- How do i get custom metabox data from each multisite blog?
- Multisite login and redirect to users main blog,
- Query postmeta values, and return multiple post_titles for common meta value
- WordPress multisite dashboard not working..!
- Parse shortcodes from another site in WP Multisite
- Custom pages on all multisite network, to NOT show in wp-admin at all
- Pulling values from a sepcific row in table
- In a MS install, can you allow different users to have their own themes?
- Install WordPress MU outside htdocs
- Redirect authors from upload.php url to Home page in Multisite
- Images on WP Network’s subsite appear only if accessed via main site’s url
- WordPress Multisite platform for different city for single db
- Multisite: should /blog go to a 404 page?
- Not being allowed to use some terms in Add New Site in WordPress
- How to redirect root blog to a specific one in multilang WP?
- 404 error in dashboard of subdomain of multisite