Meta query compare timestamp if exists
I have a custom post type with a start and end date timestamp. These fields are not required so they may not exist. What I want to do is query and show all posts that don’t have the end date set or...
View ArticleWhat format does the meta_query TIME type require?
As per title – what format does the TIME type in a meta_query require? I have a couple of custom fields, date and time – the aim is to show posts dated today and in the future up to the hour before...
View ArticleSanitize Custom Field Value in Meta Query
I’m using the pre_get_posts hook with meta_query args to filter an archive loop by dates. Basically, there is a custom post type of “events”, and my users type in a date as a custom field for the...
View ArticleWordPress meta_query not working
I am having issues with a meta query on a custom post type. The following arguments are set: $args = array( 'post_type' => 'wp_comp_entries', 'posts_per_page' => -1, 'meta_query' => array(...
View Articlehow to insert post in wordpress with meta
How can I get the data from a table into the wordpress posts? I use this code but not corectly works… if (isset($_GET['SQL'])){ global $wpdb; $num; $rows = $wpdb->get_results("SELECT * from...
View ArticleQuery Multiple Post types each with own meta query
I have 2 post types: lets say products and product_variations. I’d like to be able to modify the query via pre_get_posts to get all product with meta_keys "_visible" = "true" and "_available" = "true"...
View ArticleHow can I apply a meta query for a single custom post type in the main query?
I have custom post type called event, which has custom fields for start_date and end_date. For the event archive, I’m filtering out “expired” events using the following meta query added to the main...
View Articleloop query exclude meta_key with meta_value
Hi I use a loop like this: // show all active coupons for this store and setup pagination $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts( array( 'post_type' =>...
View ArticleWP Query – Group by relation (custom post type)
I have a custom post type Office. An office has an address, email, … . An office also has a relation with a custom post type Region. So an Office must have a relation with a relation with one region...
View ArticleIgnore sticky posts if post is not in meta query
I have such a wp query args: $args = array( 'post_type'=> 'myposttype', 'posts_per_page' => 10, 'meta_query' => array( 'relation' => 'AND', array('key' => 'routeFrom','value' =>...
View ArticleWP User Query with search columns and meta query
I’m trying to build a query with WP User Query where it’s possible to search after user_email user_nicename first_name last_name This are my args: $args = array( 'role' => 'author', 'number' =>...
View ArticleUse REGEXP in WP_Query meta_query key
I know I can use REGEXP in WP_Query like this: $query = new WP_Query(array( 'posts_per_page' => -1, 'post_status' => 'publish', 'meta_query' => array( array( 'key' => 'custom_fields',...
View ArticleOrderby doesn't work like expected on custom query
I have this custom query: query_posts( array ( 'orderby' => 'rr_recommends_count', 'meta_key' => 'rr_recommends_count', 'order' => 'DESC', ) ); Which orders the posts like this: 9, 8, 7, 6, 5,...
View ArticleWP_Query filtered by simple checkboxes
I’m trying to build a WP_Query with specific filters, i.e., checkboxes and radio buttons. The checkboxes will filter the meta-data linked with my custom post type. The meta-data is the location. And...
View ArticleHow can I include posts with a certain meta value into a taxonomy archive page?
So for example, say I have a taxonomy “Blogs” and term “News” as well as other terms like “Food”, “Sports”, …etc. On the “News” archive page, you obviously only get posts that include term “News”, but...
View Articlemeta tags doesnt fetch data from permalinks
i have a page http://studyofjoy.com/categories/ i want to add custom meta tags to heading section like this: <meta property="og:title" content="<?php echo "title:" . $get_title_raw; ?>" />...
View ArticleHow to fetch WP_User_Query with multiple role arguments [duplicate]
This question already has an answer here: Get multiple roles with get_users 7 answers
View ArticleQuery Multiple values for same key
I have tried to get 2 different posts having the values in $al. I can retrieve the posts one at a time but fail to get both together: $al = array('51.66963','51.60652'); $meta_query[] = array(...
View Articlemeta_query issue with multiple numerics
I’m having an issue with a search form. I basically have 7 input fields used to search different properties. All of them apart from the last two see to be working, as soon as I introduce the last two...
View ArticleWP_User_Query from meta_key and orderby secondary meta_key
I have this code, which works as intended, but now I want to order these by another meta_key. I’ve tried using meta_query to get another key into the mix, but am still unsuccessful. I want to get all...
View Article