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
1answer
63 views

Sort Posts with custom meta key by default which is currently set as optional

I'm new to Wordpress so please bear with me. Please check this link The posts are currently sorted by date. But if you mouse over on Latest Articles you see there are other options for sorting like ...
0
votes
0answers
79 views

Meta_query weird behaviour

I have a custom field called date_from. Dates are stored in the yymmdd format (eg 20131104). When I use a meta_query to find posts in a specific date range the query works as expected, but when I use ...
0
votes
0answers
134 views

Why is WP_Query's meta_query not filtering results?

I am working on a wordpress site that utilizes WP_Query to find songs based on their category, tags, and other things in a tax_query, but it also groups in a meta_query which (should) find songs based ...
0
votes
1answer
119 views

Including 'cat' => $cat breaks meta_query

so, i have a custom loop that seems to be working everywhere but one place. $args = array( 'post_type' => 'post', 'meta_key' => 'wpcf-post-weight', 'orderby' => ...
0
votes
0answers
32 views

How to create a link for wordpress meta datas?

I would like to create a link for "Leave a comment", which name "quick comment" (here come a ajax comment form on div). How can I do this? I have attached a picture where I'd like to put this link: ...
0
votes
0answers
110 views

Trying to combine multiple Wordpress queries

I am trying to query multiple post types and meta values in Wordpress... the query is trying to fetch event post types with a featured meta key, as well as post post types with the featured image set. ...
0
votes
1answer
51 views

using post_type with meta_query

I'm setting up a basic slideshow and want to loop through the custom post type “Projects” and display only projects with a photo attached - <ul class="slides"> <?php $args = array( ...
0
votes
0answers
65 views

Meta query “OR” comparison not working as expected with array

I have this code to get cars that have color 1 or 0 ( stored in db in rw_color as 1 for white and 0 is black): $args_search = array( 'post_type' => array( 'cars' ), ...
0
votes
2answers
60 views

meta_query compare not doing what I want it to do

I'm trying to run a query that only shows posts if it's meta value has a date string that is LESS than the current date's string. An example is below; <?php $current = date('Ymd'); // Eg: ...
0
votes
1answer
135 views

latitude/longitude meta_query

I've been trying to figure out a way to do radius search in WP and decided upon a simpler way than big queries, I'm having problems returning results though I've got a function called ...
0
votes
1answer
32 views

How to output meta_key in wp_postmeta?

I have a meta_key in wp_postmeta called _su_description. How do I output its value?
0
votes
1answer
1k views

meta_query with array as value with multiple arrays

Already got some clues on how to do this, see here: meta_query with array as value but i am confused over multiple meta_queries like this: for ($i=0; $i< count($amenities); $i++) { ...
0
votes
1answer
307 views

Creating arguments from loop for WP_Query meta_query

I'm trying to create a WP_Query with the outcome arguments such as: $args = array( 'post_type' => array( 'post', 'custom' ), 'meta_query' => array( 'relation' => 'AND', ...
0
votes
1answer
161 views

Looking for a way to exclude frontpage and nav menu from query filter

maybe I'm thinking about this the wrong way, but I need to: A) exclude posts in queries site-wide (minus frontpage and navbar) based on a comparison with a meta_value, and B) orderby a differnt ...
0
votes
0answers
18 views

Query posts than have a lapse of time active

First of all, sorry guys for my poor english. OK, i wanna make a query for show posts that doesn´t passed 3 days from it publication. I set a field for the expire date when it´s published (the time is ...
0
votes
1answer
114 views

Ordering by multiple meta keys - Custom post type

I've searched the web to try and do this but none of the examples quite resemble the way my data is currently laid out, I wonder if someone can tell me how to tailor it to my setup? This is the way ...
0
votes
1answer
53 views

Meta_query not filtering posts

I'm trying to filter out 'properties' on a page based on whether they are vacation or long-term rentals. Right now, the results of the following query displays all properties, not just either vacation ...
0
votes
1answer
97 views

wp_Query with 4 post meta feald arguments gives 500 internal server error

I am creating a custom plugin to search for custom post type provided with 4 meta field arguments. I am using wp_Query() to fetch the search results. My Query string is. $args = array( ...
0
votes
1answer
278 views

WordPress Meta Query: Relation is not working correctly

I make a custom search box and let user do search. I have added required field to my editing panel by custom meta box. I have a post which have some meta data like London as place and 13021 as post ...
0
votes
1answer
585 views

WP_Query with several meta_query-statements and order by meta_value

This is my query: $the_query = new WP_Query( array ( 'post_type' => 'pass', 'posts_per_page' => '-1', 'post_status' => 'publish', ...
0
votes
0answers
13 views

paginate_links with meta_query showing incorrect number of pages [duplicate]

I seem to be having a strange problem with paginate_links, and I'm hoping someone can help. I have a custom post type for events, events have categories and a custom field for start date and end date. ...
0
votes
0answers
157 views

Search with meta_query and tax_query

I'm working on a little database for series based on wordpress. I've implemented a custom post type called "anime", some taxonomies (Genre, a_types..) and a lof of customfields. (based on acf). Now ...
0
votes
1answer
93 views

Checking if field is set before comparing with meta_query in query_posts?

I have a query set up to compare the start and end dates for some custom fields. The start date is required for the post; however, the end date is not. This causes some issues with the following: ...
0
votes
1answer
38 views

Filtering problem

I got the custom_post_type_data in which I store some variables when I make a new post. Variables likes Author, Price etc. I implemented a filtering by author, so when you click on James (for ...
0
votes
1answer
356 views

WP_Query arguments: Loop through custom post type - get all entries except excluded meta_key?

Can't seem to find out what I'm doing wrong. $args = array( 'post_type' => 'wr_event', // my custom post type 'posts_per_page' => -1, // show all posts 'meta_query' => array( ...
0
votes
1answer
192 views

loop through custom post-type with two meta_keys

I have a custom-post-type named my_project. This post-type has two meta-boxes: is_featured is_featured_position So essentially in my backend of the post-type I can set a checkbox for is_featured ...
0
votes
1answer
498 views

Custom query (author is post_author or meta co_author) with Pagenavi pagination

I need to create a custom query for the author archive (where the author is post_author OR is a meta co_author), and it have to work with WP Pagenavi. The query is something like this (omitting $wpdb ...
0
votes
2answers
89 views

list or get meta_key where meta_value is 'something'

I'm trying to get with get_user_meta the meta_key where the meta_value is 'ive-read-this' But I do not get the value. What should I do?
0
votes
2answers
183 views

Query author's posts & posts that have author's id as meta value

I am trying to get posts with an author's ID as a meta value in the author.php template using additional request parameter. For example I want posts with john's ID as a meta value using a request ...
0
votes
1answer
2k views

meta_query with array as value

I am writing some PHP which allows users of my site to submit a form and query posts by their post_meta. Everything works fine except for one thing, I used Advanced Custom Fields to create the ...
0
votes
1answer
172 views

Querying meta values within an array

Okay so I'm using the relationship field from Advanced Custom Fields against a custom post type. The relationship lists countries, when these are saved they are within a serialised array: [country] ...
0
votes
3answers
88 views

Creating Custom Query

I've hit some sort of stumbling bock here, and I can't find my way over it. I'm trying to craft a custom WP query that searches for posts by country of origin, selecting multiple countries at once. ...
0
votes
1answer
387 views

WP_Query orderby meta key/value suddely stopped working

I have code that has been working for a long time which when a user clicks a button to order database results by name/value, it gets the results via AJAX from a page that does all the querying. I ...
0
votes
2answers
485 views

Custom Post Type + Custom Meta Query Not Showing 2012 Posts

I created a custom "events" post type for a client that basically "hides" the post once it has expired (ie. the event already happened). The events are displayed in the order of the start date rather ...
0
votes
2answers
285 views

meta_query and strange orderby behaviour

this is my problem query, which picks all future or pending events. Note that some posts only have _startdate without _enddate (1-day events). $args = array( 'post_type'=> 'events', 'meta_query' ...
0
votes
2answers
476 views

order by meta_key [duplicate]

i have a little problem: I can not order my events as i wish. I would like to order my upcoming events in ascending order... I am using the following: new WP_Query( array( 'author' ...
0
votes
2answers
594 views

Query based on custom fields start and end date

I have a custom post type called Events, with 2 custom fields, start date and end date. These fields are stored using a timestamp in the database. I want to create a custom query based on these 2 ...
-1
votes
1answer
524 views

Wp query by 2 meta field - check if they exists / have value

I am looking for the shortest most resrouce affective (not mysql query) to count the amount of posts that have 2 meta keys <-- if they exists i found this simple way at the codex but it checks for ...
-1
votes
1answer
105 views

294 Queries on Mainpage of Wordpress

I have 294 queries on my wordpress site. I checked using sql monitorand the maximum queries are to display count of a cities list custom field. Lets say there are 200 cities then 200 queries are ...
-2
votes
1answer
531 views

Too many if's and else if's ?? - Must be better way [closed]

Everyone on this forum has helped me tremendously. Thank you. I now have a page that functions the way I want it but my code seems to be cumbersome. To figure out a string to echo I have a long ...
-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?
-2
votes
1answer
140 views

Get all user with both meta_value

I was wondering if there were any efficient way of fetching all user comparing two different meta_key. I am currently fetching all user compared to the first meta, then loop trough the user_id to ...