You have to do a join or a subquery:
$querystr = "
SELECT $wpdb->posts.ID
FROM $wpdb->posts
WHERE $wpdb->posts.post_type="post"
AND $wpdb->posts.post_date < NOW()
AND $wpdb->posts.ID NOT IN
( SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = '_social_' )
ORDER BY $wpdb->posts.score DESC
LIMIT 1;
";
Related Posts:
- INSERT ON DUPLICATE KEY UPDATE failes in postmeta table
- SQL query – get a featured image’s alt / alternative text
- Sorting my posts on homepage my specific value in post_meta table
- How can I get the post ID from a WP_Query loop?
- How to edit a post meta data in a Gutenberg Block?
- How we get_post_meta without post id
- What is the code to get the download link for a product in WooCommerce?
- Search custom post type by meta data
- How to update/delete array in post meta value?
- Adding an assisting editor box to Post page
- How do I retrieve multi-dimensional arrays from the wp_postmeta table, & display on a website?
- Get Advanced Custom Fields values before saving [closed]
- Why am I getting an infinite loop with have_posts?
- How to store post meta in an array?
- adding a URL to a post meta
- update_post_meta() not working when used with WordPress action
- Filter query posts by the count of metas for a meta key
- Adding meta data to an attachment post
- Get posts by meta value with date
- Automatically adding meta data to posts or multiple query help
- Get updated post meta on save_post action?
- Save default value for empty or missing post meta
- Delete post meta conditionally after save post
- Problem With Order Item Meta In Woocommerce
- Job of meta_key meta_value fields in database tables
- Query 2 meta key values and a category
- Best way to save postmeta
- How to add meta data to WordPress posts?
- How to update Post Meta values through the comment system
- Filtering multiple meta_values
- how to build (custom) stats for post views, per month
- get_post_meta pagination
- How add post_meta from user_meta?
- How can I get my iFrame to work with url from post_meta?
- How to use update_post_meta() function properly?
- Hey, I want the second options. get_post_meta()
- Update post meta in woocommerce order frontend
- How to display post view count by date, week and month?
- How can I filter posts when the meta_value is a serialize object?
- Get User Post if Private
- How do I dynamically call a page/post author into the meta data?
- Set Condition echo function get_post_meta
- Unknown characters added to meta data values
- get_post_meta($post->ID) returns empty string when in preview mode of custom post type
- Read post meta values, only if posts are public
- get_permalink vs the_permalink
- Time & Date on Post – Time Ago Custom Function
- Updating my Post when expiry date is past
- Mass removing CSS from 1,700 post [closed]
- How to display sql query fired by posts_where
- Unfiltered html with update_post_meta
- why after saving meta value it’s saving all the values the one that i clicked?
- How is the author’s name given a different color?
- Returning a custom content types with meta values
- How does WordPress treats attachments metadata in post content?
- URL to Post Meta [closed]
- Retrieving post meta array (attachment)
- is_main_query() never called on WP 4.4
- Declaring a var, placing it in a query and using the output of the query?
- Stop `update_post_meta` from working each time page refreshes?
- get_post_meta in one post only
- Combining two meta_values within one row with query
- Displaying the ‘time ago’ for recent activity within a post/custom post type?
- add post meta front end edit
- How to query and update one colum in postmeta table?
- How to remove date from showing in meta description
- How to save HTML data into SQL post_content column
- update post meta value with other post meta value
- Post Publish date not display on Umaya Child themes
- How to merge the database results into single result?
- Check For get_post_meta on Author Archive Page
- Negative meta_query if storing multiple post_meta values with shared meta_key
- How can I update this array built from post meta data?
- What format is this and how to get value “lal” and “pila” from it
- Frontend query and does not need to log in [closed]
- Get data from custom table and update relative post_meta based on meta_key
- How to get the total of two meta values from different meta keys?
- How to save a meta_value as a numeric value after I retrieve it via update_post_meta?
- Display multiple meta_key/meta_values by single SQL query
- searching by keywords in post’s metas or pagination links problem
- Programatically delete several attributes in _product_attributes in post meta
- Get post meta after insert post
- Data not displaying in text field
- How do you sort the items in a custom taxonomy meta box?
- WP-API + JS Backbone client – how to update post meta
- What is the best way to query posts based on live data?
- Proper Way to Sanitize Meta Input
- update_post_meta returning false when called during init
- meta query always fails even if data is correct
- post_title in save_post action
- Ordering posts alphabetically by meta keys and title
- Getting meta content from get_next_post & get_previous_post
- How to get pictures of the WordPress post
- How to query post ids liked by the Author
- When importing posts to a new site if XML file has postmeta not setup on new server what happens?
- Access Serialized Post Meta Values
- Cache metadata for set of posts
- Does post-meta belong in header?
- Problem with get_post_meta
- Save frontend submission form field as custom field