I’m not an SQL expert, but I would think you might have to JOIN twice to pick two distinct rows out of wp_postmeta
:
$featuredquery = "
SELECT wposts.*
FROM $wpdb->posts wposts
JOIN $wpdb->postmeta article_level ON
( wposts.ID = article_level.post_id AND
article_level.meta_key = 'article_level' )
JOIN $wpdb->postmeta article_genre ON
( wposts.ID = article_genre.post_id AND
article_genre.meta_key = 'article_genre' )
WHERE article_level.meta_value="Hovedsak"
AND article_genre.meta_value="X6.no (Spill og underholdning)"
AND wposts.post_status="publish"
AND wposts.post_type="post"
AND wposts.post_date < NOW()
ORDER BY wposts.post_date DESC
LIMIT 0 , 4
";
Related Posts:
- Explanation of update_post_(meta/term)_cache
- cleaning up safely wordpress wp_postmeta table
- what is the correct way to compare dates in a WP query_posts meta_query
- How can I get the post ID from a WP_Query loop?
- How to edit a post meta data in a Gutenberg Block?
- How to delete outdated, wrongly sized images in _wp_attachment_metadata?
- How to update/delete array in post meta value?
- Adding an assisting editor box to Post page
- Manipulating post meta in the customizer
- 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?
- adding a URL to a post meta
- ajax delete value from custom field array
- Adding meta data to an attachment post
- Get posts by meta value with date
- Get updated post meta on save_post action?
- Delete post meta conditionally after save post
- Problem With Order Item Meta In Woocommerce
- How to store Gutenberg ColourPicker RGBA as metadata
- Is it possible to update a post meta field through REST API if the format of it when registered is nested?
- Query 2 meta key values and a category
- trying to do if post meta !=0
- Trying to get file name
- Best way to save postmeta
- Custom Post Type, Saving Multiple Checkboxes
- How to add meta data to WordPress posts?
- How to update Post Meta values through the comment system
- Filtering multiple meta_values
- How to remove query string from static resource in WordPress?
- How add post_meta from user_meta?
- How can I get my iFrame to work with url from post_meta?
- Removing Post Meta from Category Pages?
- How to use update_post_meta() function properly?
- Hey, I want the second options. get_post_meta()
- populate post meta in gravity forms [closed]
- How to display post view count by date, week and month?
- Get User Post if Private
- How to receive all the meta information of a post ?
- Update postmeta Parent when post_status child change
- How do I dynamically call a page/post author into the meta data?
- Set Condition echo function get_post_meta
- Compare old meta with new post meta
- Getting value from get_post_custom
- need to add add user names to the post for later retrieval or removal
- Trying to get property of non-object error using get_post_meta()
- Like & Dislike functionality using JavaScript
- How can I change the tag contents of individual WordPress posts?
- get_post_meta producing white screen of death
- get_permalink vs the_permalink
- Look up all posts by status or meta value – performance difference
- Updating my Post when expiry date is past
- How to remove Date from Meta Description on SERP?
- Can A Post Meta Field Store multiple values that are not in an array?
- esc_attr on get_post_meta [closed]
- How to display sql query fired by posts_where
- Unfiltered html with update_post_meta
- get meta value from page query
- Sort custom posts in archive by multiple values: date AND meta key
- 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?
- URL to Post Meta [closed]
- Retrieving post meta array (attachment)
- Why is variable that get_post_meta stored in empty?
- Orderby two meta fields not working
- get_post_meta in one post only
- wpdb->get_var – count author posts, meta value
- 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
- Search post overlapping dates – meta_query with meta_key
- How to save HTML data into SQL post_content column
- update post meta value with other post meta value
- 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 bulk Update URLs to new values?
- 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?
- Get or set values in post meta
- 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
- Proper Way to Sanitize Meta Input
- update_post_meta returning false when called during init
- Save values from foreach loop in wp_editor
- Getting meta content from get_next_post & get_previous_post
- How to get pictures of the WordPress post
- Get value from post meta array, and add it as a category
- Select Options Meta Data is Not Updating in Edit Meta Box
- Access Serialized Post Meta Values
- Cache metadata for set of posts
- Problem with get_post_meta
- Post meta box data not saving