Tagged Questions
0
votes
2answers
26 views
meta_value and meta_key filtering returning no posts [closed]
this might sound like a very stupid question, and I am almost ashamed to put it here... however, after using the code straight from wp codex, and trying a couple of other variations from googling ...
0
votes
1answer
23 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
20 views
2 orderby in wp_query with 2 custom fields
I'm triyng to display hotels (taxonomy which i have created) by two 'orderby' with wp_query but i'm not success.
Results looks likes:
Hotel 1 : 2 persons 5 stars
Hotel 2 : 2 ...
0
votes
0answers
34 views
Complex WP_Query Using Post Date And Post Meta
I am using Wordpress as a CMS on a website which has standard posts, a custom advert post type and a custom event post type. The event post type has some custom meta which stores the event start date.
...
0
votes
0answers
34 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
0answers
41 views
Custom WP_Query for WordPress Search Results with meta_query
I am using a custom query to generate my search results. The code I am using works perfectly without the meta_query variables in my arguments array.
I am trying to compare multiple custom fields with ...
0
votes
1answer
73 views
Custom query with category exclusion and post-meta “whitelist”
I have two widgets, one shows News while the other shows everything except News (We'll call the second one Blog). The blog portion is currently working correctly.
The News posts are either ...
0
votes
1answer
74 views
Filtering a WP_Query meta_query by numeric values isn't working
That was a very dense title.
I have a custom post type "event" which has a Date/Time picker field "event_date" thanks to the Advanced Custom Fields plugin. This Date/Time picker saves a UNIX ...
2
votes
1answer
76 views
WP_query : meta_key with custom rule for specific value
I'm a bit stuck with a WP_Query code. Here it is :
$args = array(
'post_type' => 'post',
'meta_query'=> array(
'key' => 'karma',
'compare' => '>=',
...
0
votes
0answers
57 views
Query recent posts by author
I'm fairly new to wordpress but trying to get recent posts by a specific author. The following code displays only most recent bog posts. I am using a custom field to get the author ID.
EDIT by ...
0
votes
1answer
45 views
404 on Pages for Custom Post Type & Query_Posts
It took me quite a while to find a good solution for ordering a custom post type by two custom meta keys. When I finally got it working, I found out the pagination no longer works. I've tried dozens ...
0
votes
1answer
158 views
WP_query multiple custom fields not working
I am currently using WP 3.1 and trying to get WP_QUERY to work with the custom fields. My argument is as follows:
$args = array(
'post_type' => 'post',
'meta_query' => array(
'relation' ...
0
votes
1answer
42 views
Cache issue with WP_Query and custom field filtering
I have three separate WP_Queries on a page. Each of them return custom post type items that have a certain checkbox checked and then display one of those randomly. The checkbox has been added using ...
1
vote
0answers
30 views
Meta Query And/Or
My question is very similar to Meta Query with AND & OR? . This question was answered in 2011 by @Otto.
With the exception that my logic is different.
I want to query, for example, posts with ...
0
votes
0answers
18 views
Sidebar IF query hiding everything
I have this query which I'm using in the sidebar, but when I place it in a php widget, the whole sidebar disappears... The code is below and the full sidebar code is in a pastebin here ...
0
votes
0answers
14 views
Altering query to return more data
I am building a web app with WordPress. I have a situation where every time I do a while ($query->have_posts()), I immediately do a get_field('due_date'). I'm using advanced custom fields. This ...
0
votes
1answer
189 views
Upcoming Event: How do I sort database by custom date field, but ignore past dates?
I am using an events plugin and struggling to get my database query to be perfect. The query is on the event-single.php template. What I need the query to do:
Query the "events" custom post type ...
0
votes
2answers
64 views
Any way to include custom fields in WP_Query results?
Looking for a way to include custom fields in the output of WP_Query. I am managing a site where nearly every post type has a lot of custom fields defined and it would be much nicer not to have to run ...
0
votes
1answer
123 views
WP_Query orderby not working with meta_value_num and menu_order
I have made a custom post type (sidebar_element) which are shown on sidebar. On each sidebar element admin can choose where in sidebar should that element be shown, ie. 'top', 'middle' or 'bottom', ...
1
vote
1answer
405 views
How to sort CPT by custom meta value (date), and return posts month by month
For future reference:
I am using the great Meta Box Plugin to help expedite meta box creation for my custom post types.
My goal:
To build a highly customizable events section closely resembling a ...
0
votes
1answer
172 views
Query posts by Custom Meta (checkbox) & Genesis Grid Loop
I've been trying tons of things for the last 2 days. I'm at a standstill now. I read a ton of posts here but nothing has worked yet.
I have a CPT 'artists'. This CPT contains a custom field ...
1
vote
1answer
45 views
Query Posts With Over 1000 Views
The code below is from this link. It basically creates a hit counter, but I'm probably gonna have to do this by IP.
How do I make a WP_Query, where only posts up to 1000 views can be seen on the ...
2
votes
1answer
356 views
WP Query group/order by category name
I have a requirement for displaying a list of custom post types grouped by category, but in addition to this, each custom post is linked with a meta value (in this example lets say we have a custom ...
2
votes
1answer
296 views
Advanced Custom Fields query
I have, hopefully easy question. I have my query here, which is using ACF
<?php query_posts(array('post_type' => 'our-clients-list', 'posts_per_page' => 1, 'order' => 'DSC', 'orderby' ...
2
votes
0answers
43 views
Query meta field using between
I'm trying to Query some lattitude and logitude and then I get some long numbers and apperently the Query dont like that.
Let says I have these in the database
Meta-key: lat
Meta-value: 54.3415000
...
1
vote
1answer
38 views
How to combine custom fields to make one order-able value
I have three different custom fields, for day (01-07) hour (01-12) and minute (00-59) and I really need to combine them into one custom value so I can actually order them using wp_query.
I cant ...
1
vote
1answer
101 views
Using OR in WP_Query negates the “NOT EXISTS” compare
I'm attempting to filter posts by a custom field that either are equal to 'new' or have not been set yet. I'm able to get either of those meta_queries to work on their own but when I use them in an ...
2
votes
1answer
123 views
$wp_query meta_key naming issue
What I am attempting to do is sort posts by custom fields.
I have a few custom fields that don't query properly and I get the 404 page. The fields that don't work I used hyphens in the naming ...
0
votes
1answer
67 views
How can I sort posts by the date and a custom meta field?
I have custom meta field that I use for the post rating.
So I want to display posts by the date and the rating, but only for the posts that have specific rating.
For example, I want to display posts ...
0
votes
1answer
269 views
Get post info inside modal window?
What I'm Trying To Do
I have set up a custom post type for 'movies' and below is how I set up the template. Basically, I am trying to get a.thickbox (in the code below) to open a modal window with ...
0
votes
1answer
253 views
Display posts where date field matches current month?
I have a loop which displays all the posts of the "events" post type on my site. Each of these posts has a custom date field "event_date", which I sort the display of the loop by.
I would like to ...
0
votes
1answer
137 views
Select custom posts by meta_value and sort by a different meta value
I have my query set up like this:
$article_query = new WP_Query(array(
'meta_key' => 'issue',
'meta_value' => $post->ID ,
'post_type' => ...
0
votes
1answer
65 views
Show posts containing or not custom field
I'm trying to show aditional posts in the author's page. This page must have posts containing a specific meta_key and meta_value, where the displayed author it is not really the WP post's author.
...
0
votes
1answer
427 views
Using WP Query to search by multiple meta fields
I made a custom search form with select boxes and text fields.
I have a select box with options like "renting" and "selling" (its a real estate site)
There are also input fields for minimum and ...
1
vote
1answer
191 views
How can I combine meta_query queries?
I'm trying to build combined meta_query queries but they don't work.
Any ideas how I can implement queries like the example below?
Thanks, Hinnerk
Array
(
[relation] => AND
[0] => ...
2
votes
2answers
87 views
Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
I am currently trying to perform a custom query on the authors page (author.php). I have two custom fields for posts that I want to query against (post_photographer and post_videographer).
What I am ...
1
vote
1answer
519 views
Can I query custom meta data through WP_Query
Ok, my question is a bit complex so I will try and give a general explanation and then go into details afterward.
I am running WordPress 3.4.2 and I am using WCK Post Type Creator and WCK Custom ...
1
vote
1answer
571 views
Multiple orderby values in WP_Query
I'm trying to come up with a query to sort by multiple orderby values. Here's what I have so far:
$dept_id=2;
$query=new WP_Query(array(
'post_type'=>'wpcontactus',
...
0
votes
1answer
88 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
1answer
214 views
How to get a meta value from all post
I searched for a while but I didn't find any solution. I used the functions listed here.
It outputs something like this:
Array
(
[0] => 15
[1] => 30
[2] => 50
)
But I want ...
1
vote
0answers
150 views
Trying to perform complex custom field query with order by set to field value
I've got two custom fields for event posts: event-start and event-end. When I'm querying for current events, I'd like to show any post where the event-start OR the event-end is greater than or equal ...
2
votes
1answer
93 views
Sort by posts that have a featured image?
I'd like to sort posts on the index page to show those that have a featured image first.
I've done this in functions.php:
add_filter( 'pre_get_posts', 'my_get_posts' );
function ...
0
votes
1answer
104 views
Can't query by meta_key
For some reason. I do not have the ability to query by meta_key when I run a loop.
What could cause this and what can I do to the diagnose the problem? I am using wordpress 3.4.1.
$args = array( ...
0
votes
1answer
405 views
Adding custom field and querying from post table
I've been trying to figure this out for a while now. So I'm trying to add a custom field call "counter" to every single post. I try simply inserting the field "counter" to the post table. Every time a ...
0
votes
2answers
195 views
WP Query Returning All Posts
I have a custom WP query that is returning every post, instead of just the ones being specified by the query. I can't seem to find anything wrong with the code, so I must be missing something:
...
0
votes
2answers
148 views
Custom Query Fields - Altering Meta Value
I'm giving Custom Query Fields a shot for filtering/sorting posts on the front-end of a site. The instructions seem pretty self-explanatory, but I do have another layer that I'm trying to figure out.
...
1
vote
2answers
1k views
How do I use wp_query for WordPress search?
I would like to create a custom search form to search posts based on the values of about 4 custom fields. I tried using wp_query to achieve this but so far my biggest problem is that the I don't get ...
1
vote
1answer
347 views
WP_Query display next custom post from today's date
I have a calendar plugin that uses custom posts types to create events. There are several custom fields that allow me to create various and seemingly unlimited post queries. The one I'm currently ...
0
votes
1answer
277 views
Meta query with timestamp using WP_query
I'm having a problem with an events system that I'm developing for a local roller derby leaugue. I have made a custom post type ('event') where a user can add a few different types of events ...
3
votes
2answers
155 views
Order Posts by Closest Numeric Values
I'm using custom post types to display properties and have a custom price field assigned to each post. On the property page I want to display a list of four similarly priced properties, two less than ...

