Refers to a mechanism built into the WP_Query class for querying the database for post data, including pages and CPTs, based upon post meta data.

learn more… | top users | synonyms

0
votes
0answers
5 views

WP_Query with UNIX timestamp in meta query

now idea why this isn't working, please point me in the right direction! Here's my main query; $events = new WP_Query( array( 'posts_per_page' => -1, 'meta_query' => array( ...
3
votes
1answer
82 views

Different page parameters inside query

I get with that code some pictures from different pages they have a special parent page. $query = new WP_Query( array( 'post_type' => 'page', 'post_parent__in' => ...
1
vote
0answers
18 views

Compare meta_query with a Regular Expression and do a less-than operation on it

I have the problem that my client is using a theme which stores options of items in a serialized way in the post_meta table. I already found out that this is not the best way to save values ...
0
votes
1answer
20 views

Filter and Order by Multiple Custom Meta Values

I am trying to query a custom post type, order by a custom meta value, and only display posts with a different custom meta value. I am able to do each independently but not both at the same time. ...
0
votes
0answers
9 views

Attempting to modify cpt archive with query var

I have a custom post type, messages (slug is watch), and I added a query var, speaker, as well as the rewrite. If the url is /watch/speaker/Speaker+Name it modifies the query to include that. If it's ...
0
votes
0answers
28 views

List Most Read Posts from last 7 days (with custom post type and other meta queries)

I am using following code in my functions.php to count the views of the post. // function to display number of posts. function getPostViews($postID){ $count_key = 'post_views_count'; $count = ...
0
votes
0answers
31 views

Ordering posts having multiple post-meta date fields

Hello WordPress developers. Over the years, I've found answers to many questions I've had with WordPress. I want to thank you for your help. Today, I have a question myself, and seek for expert ...
1
vote
1answer
20 views

Wp Query custom search by meta query

The post meta name of a post is "Klevis V. Miho". Now when searching for: "Klevis Miho" => Nothing displays Is it possible to show results with that search string? Below is what I am up to now: ...
-2
votes
0answers
22 views

Using meta_query with tax _query

I need to know the correct syntax for filtering data using meta_query with tax_query. Also need to filter the data with more that two meta boxes with "and" condition. Any suggestions?
0
votes
0answers
34 views

Events with multiple event dates + permalink for each date

Hope you're well. I was wondering how to achieve something like this in wp: Bascally it's a list of events ordered by the event date. I know how to do that. But the tricky part is that an event may ...
1
vote
3answers
57 views

Using meta_query with multiple keys and compare values

I suspect I may be asking for the moon on a stick with this, but: I have a filter for my shows custom post type. The filter uses standard taxonomies attached to shows, but also allows the user to ...
0
votes
1answer
44 views

Comparisson between date() and a date from wp_postmeta

I am using the calendar plugin: "The Events Calendar", and is trying to get the events that are done. I can't see what it is that I'm doing wrong, but I'm pretty sure that my meta_query is wrong, ...
0
votes
2answers
29 views

Meta query with a sub query group possible?

I have searched all through the forums and WP docs, but can't find an answer to whether or not WP Meta Query permits a sub meta query. My problem is this: I have a number of types of promos (custom ...
0
votes
1answer
54 views

pre_get_posts filter meta_query without conflicting existing meta_query

I have a meta_key on all posts that is designed to check the current user role and only return the post if the user has an acceptable user role. The problem I am running into is that my meta_query ...
0
votes
1answer
31 views

Get all posts with a certain meta key, except for one with specific title

I need to return all posts with post_test_safe == 1 and exclude one with title ="Special title" Some kind of combined meta query but haven't got anything to work. function getAllPostIdsTest(){ ...
1
vote
2answers
57 views

Meta Query relation “AND” then set array accordingly

I have a search form on my home page that sets up the url query_string accordingly for the code below. When I use or I get results. However when I used "AND" for the relation I dont get any results ...
4
votes
1answer
85 views

compare meta_query in get_posts arguments

I like to exclude certain posts with a custom field. So if my_custom_field_ignore isset AND 1 ignore this post. If it's not set include it. This is what I have $args = array( 'post_type' ...
0
votes
1answer
42 views

How do I add an item to the WP admin menu?

I want to add an item to my WordPress admin menu - "News" - it's to contain a list of articles written about my company. Each article will consist of the following metadata: Headline Date Link to ...
0
votes
1answer
36 views

Querying by meta key and value

I have a custom post type which has an array as a meta data. Here's how it looks inside wp_postmeta table. meta_key: _allowed_companies meta_value: a:2:{i:0;s:3:"275";i:1;s:4:"8386";} Obviously, ...
0
votes
0answers
45 views

How to show specific meta keys of all posts in admin panel?

I have some common meta keys on every post. Ex: hotel_person, hotel_number All the posts have these two meta keys. I want to show these meta key values and the post titles. All these values and ...
0
votes
1answer
20 views

Show category meta in loop on homepage

I'm working on a site that groups content into 'issues' using categories. The home page shows the latest issue by pulling the category with the highest ID (thus the most recent). What I want to do is ...
0
votes
1answer
36 views

Multiple meta query from array

I need to do multiple meta query from my array. I have something like this: $search_term[] = array( 'key' => '_cmb_listing_status', 'value' => 'Active', 'compare' => '=' ); foreach ( ...
0
votes
1answer
25 views

Advanced Post Display/Pagination/Ordering

I am working on a project that requires some advanced ordering of posts and advanced pagination. Basically, we have posts in a category, lets call this category 'mycategory'. We then have post ...
1
vote
1answer
21 views

Admin Custom Meta Box - Pull Last 5 Posts from Custom Post Type

This is what I'm trying to accomplish, I have a custom post type of "demos", from here I can add custom CSS/HTML/JS to display a demonstration (online preview) of what it is I have designed/coded. ...
0
votes
1answer
108 views

Order by meta value pro first then meta value free in my search function

My meta key is geo_listing_type and this key have 2 meta_value, pro and free. I want to order these by pro first then free <?php get_header(); ?> <!--Start Content Wrapper--> <div ...
0
votes
0answers
21 views

Ordering a custom meta query

I have a events custom post type. Each event has to meta fields: eventstart and eventend. These are both YYYY-MM-DD style dates. I am trying to get a list of my events that have a start date OR end ...
0
votes
1answer
79 views

Meta query with compare by more than 2 fields

i have 5 sets of meta boxes in some custom postype. So.. i know how to compare two meta box values... Example: 'meta_query' => array( 'relation' => 'AND', array( 'key' ...
0
votes
1answer
74 views

WP_User_Query with combined meta query - not working?

I'm trying to use WP_User_Query class to list all users basing on their specific meta fields. When I use simple single-meta query, it works fine: $q = new WP_User_Query( array( 'role' => ...
0
votes
1answer
65 views

Query Posts, order by meta value

I've read a lot, tried a lot more, but can't get what I want: I have custom post types, which I want to order in DESC, orderby its meta value: The complete query with its arguments: ...
0
votes
0answers
70 views

How can get Custom Posts Sort by Hour

I need to show posts from 00:00:00 AM to 00:00:00 PM, and orderby day too. How can i do that? Look the following code: $programasQuery = new WP_Query(array( "post_type" ...
0
votes
2answers
47 views

Show single posts date, in a page of posts

In a page of posts, how do I show their date, instead of the page date? I have no php knowledge. Let's say I want to show the single posts date here, instead to the single posts title. <?php ...
1
vote
0answers
60 views

WordPress Filtering Custom Post Type by Metadata and Search Heirachy

I have a custom Post Type called cptMovie which has two Custom Field (Metadata) "Language" and "Box office" assigned to it. I also have a Custom Taxonomy called movieTax with 4 tax Terms "Action", ...
0
votes
0answers
46 views

WP_Meta_Query object with conditionals

I have a custom post type (Books) that is connected with a second custom post type (People). The Books CPT has an additional author meta box that if checked, it should appear on the additional People ...
3
votes
1answer
98 views

Order by meta_value_num DESC and meta_value ASC on WP 4.0

I have created a custom post type that I want to order by custom-field-1, which is boolean so its value is either 1 or 0, in DESC order (1 to 0) custom-field-2, which contains text and is supposed ...
0
votes
0answers
78 views

Custom Upcoming Events List for Events Manager Plugin

I'm using Events Manager plugin. I want to list upcoming events without widget. (2 event with big thumbnail image, after then 4 event with small thumbnail image.) Tried this code: <?phpfunction ...
0
votes
0answers
30 views

Orderby Meta Value and Query from Meta Query

The following query is returning blank with no errors and I'm not sure why. Query Arguments: $args = array( 'post_type' => 'games' , 'posts_per_page'=> -1, 'meta_query' ...
0
votes
0answers
32 views

How to compare date in post meta value

I have some custom meta fields. Some are date fields but WordPress saves everything as a string, so how can I compare the dates? $meta_query_args = array( 'relation' => '', // Optional, ...
5
votes
1answer
176 views

How to Compare Two Meta Fields

Consider two meta fields balance and monthly_price. How you would get all posts that has balance < monthly_price Thinking of creating meta query but our both fields are arbitrary or do not have ...
0
votes
1answer
32 views

Comparing 2 Decimal Numbers from custom fields and displaying posts

This is really confusing me. Hopefully you can help me. What i want to do, is search for a number and display anything that is either minus 1 or plus one of the search result. The numbers that it will ...
0
votes
1answer
27 views

Does meta_query working with value paramater higher then 999?

I am trying to get posts by price using query_post() function. Price must be in range between two values. This I made using meta_query. But when I cant get posts when right value higher then 999 in ...
0
votes
1answer
19 views

Wordpress giving a 404 page when passing a year argument different than the current year

On this page you will see I'm listing events that fall in certain months: http://conciergemaps.ch/events/ This is on Wordpress, When you select a certain month and year it appends the URL with two ...
0
votes
0answers
18 views

Sorting events by meta date value after current date

I have custom post type "Events" and also have custom meta box date, in default mode its working and sorting events with published date, but i want changing events sort by custom date, i've added that ...
0
votes
1answer
28 views

Return a single custom post from multiple meta queries

I'm currently working on a widget which returns a single random featured property on a website but I'm having some trouble with my WP_Query arguments. In the backend I have 2 checkbox meta fields ...
0
votes
2answers
89 views

What Is meta_id In wp_postmeta?

I am trying to add some data in WordPress Custom Field and via adding more direct records/data in wp_postmeta table via SQL query. There are four column as mentioned below... 'meta_id' - A unique id ...
0
votes
1answer
103 views

Selecting posts older than the current Unix epoch timestamp

I am trying to perform the following query, which originates by the fact the post's 'date' and 'time' are entered as separate custom fields. $args = array( 'post_type' => ...
2
votes
1answer
62 views

Is “orderby” in WP Meta Query conflicting with Meta Query?

I'm trying to write a meta query that looks for either events starting within the next year (event_start_date between now and 52 weeks), or events that are still going on (event_end_date between now ...
0
votes
1answer
35 views

Array sorting by custom field date

I want to order the array by a date field called date_start but how do I include a meta key for this if I already have one? $currentshowid = get_the_ID(); $today = date('Y-m-d'); $args = array( ...
0
votes
0answers
19 views

Is it possible to apply a meta_query to one specific post type in a query with multilple post types?

I have two post types, news and events : A news has no custom fields. An event has two custom fields : start-date and end-date. I want to display news and events on the same page, ideally with ...
0
votes
0answers
43 views

running queries of multiple post types

I am trying to figure out the query I need to build for my project. I've got a little idea but i am getting confused by all the different query methods and I'm not sure which one to use. I have two ...
2
votes
1answer
155 views

Meta query with string starting like pattern

I have a custom WP_Query with the following meta_query: $meta_query = array(); $meta_query['relation'] = 'AND'; if(!empty($postcode)) { $meta_query[] = array( 'key' => 'postcode', ...