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.
0
votes
2answers
311 views
pre_get_posts and set
I have some functions into my pre_get_posts filter. So, the problem is that when I set a meta_query, all the menus disappear from the page.
function propersearchfilter($query) {
$taxarray = ...
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] => ...
0
votes
2answers
58 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?
1
vote
1answer
94 views
query order by date on custom type: wrong order
I know there are very similar questions ans answers out there already, but I simply cannot get my query to get into the right order.
I have a custom post type ("bb_articles") with custom fields, ...
0
votes
2answers
950 views
Wp_query order by multiple custom fields?
I am learning WP_query and recently ran into a problem.
I need to do a query where i first filter trough one or more custom fields, which works great thanks to meta_query.
However, i also need it to ...
6
votes
1answer
3k views
Meta_query compare operator explanation
I noticed that there are bunch of operator can be use for compare in meta_query.
However, I am not quite sure what operator I should use, it is somehow confusing like = and LIKE operator.
I would ...
0
votes
2answers
85 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 ...
1
vote
1answer
90 views
How to stop wp_postmeta from being called on archive and search pages?
Currently, when I load a search or result page, it queries the wp_postmeta table which is leading to the page taking ages to load. I realise this is a result of this table being huge (70k rows), and ...
2
votes
2answers
137 views
What is an efficient way to query based on post_meta?
The problem I am having is when I allow users to filter posts it overpowers the database and things run extremely slow. I am unsure what the best way to query posts using meta values is. My site has a ...
0
votes
1answer
99 views
WP_Query Class custom field parameters
In the the class WP_Query, using the meta_query(array).
The wordpress codex says that the 'value' is a string|array. The array support is limited to a compare value of 'IN', 'NOT IN', 'BETWEEN', or ...
1
vote
1answer
79 views
Get content from pages with same meta_key from Database
I need help!
I'm doing this template page and I want to get content from pages with the same meta_key.
I want to display all pages thumbnails that has the value "red" in the meta_key.
The problem is ...
5
votes
2answers
427 views
Complex meta query with 3 keys
I think the problem essentially relates to sql query structure and I am not an expert....
I need to search for posts (custom post type) by 2 parameters:
pd_city
pd_country
Please note that ...
1
vote
1answer
84 views
7
votes
2answers
265 views
meta_query sorting by 2 keys
I need to sort (custom) posts by 2 custom field values...
custom field name 1: is_sponsored [ value can either be 1 or 0 ]
custom field name 2: sfp_date [ timestamp aka current post date in seconds ...
0
votes
2answers
83 views
get Insert id for meta field
I'm in a situation where i also need to get the id of the inserted meta( meta_id for post meta and umeta_id for user meta)
For eg i add a user meta
...
1
vote
1answer
129 views
meta_value_num sort glitch
i have a custom query, and I have a meta key that contains a sequence number: 1.1, 1.2, 2.1, 2.2... 11.1, etc
the problem occurs when the numerical sequence gets in to double digits, ie. 5.11, 5.12, ...
1
vote
1answer
523 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 ...
0
votes
2answers
528 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
193 views
Meta query: get posts with value in a multidimensional array
I have a custom post type, Album, which has a custom field called 'tracklist'. Tracklist is a multidimensional array which contains a track title and track link, like so:
$tracklist = array(
[0] ...
-2
votes
1answer
106 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 ...
1
vote
1answer
178 views
Filter posts with meta_query NOT IN where value has multiple values
I would like to use a meta_key to store multiple values in that key. Thereafter, I would like to filter away posts that do not contain a specific value in the key. In other words, just show posts ...
0
votes
1answer
424 views
search query within custom taxonomy term, post title and meta field
I want to create a search that does:
Search within my custom taxonomy - custom-tags
search the post title
search select meta field ?? dont know
search with custom post type - easy part
I looked ...
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] ...
1
vote
1answer
194 views
Use meta_query to get title of associated post
I have two post types that I've associated in one direction by assigning Post A as a custom meta field of Post B. I need to search based on the titles of Post A and return the associated Post B ...
0
votes
1answer
52 views
Meta query stopped working
The following query stopped working all of a sudden and I can't figure out why.
<?php
$today = date("Y/m/j");
query_posts(array(
'post_type' => array('events'),
'meta_key' => ...
0
votes
1answer
575 views
$wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
I have a custom post type 'event', a custom meta field 'event_date' and a custom taxonomy 'locations'.
I want to query $wpdb to retrieve posts in this way
posts must be of the 'event' post type
...
3
votes
2answers
318 views
Query between two meta keys
I feel like I'm extremely close on this one but the query keeps on showing up empty. Basically, I'm trying to query the custom values between two dates. Records should be returned if the start date is ...
1
vote
0answers
219 views
Meta query with multiple custom fields for archives page ordering problem
I'm modifying the query for archives pages so that the posts showing up on year, month or day pages are queried by there custom field (start-date and end-date) and are sorted by custom star-date ...
0
votes
2answers
242 views
How to query posts based on lat-lng coordinate as post meta?
I'm planning a custom WordPress theme where the Custom Post Type (CPT) will have latitude and longitude coordinate as it's meta value. The latitude and longitude will be displayed as a Marker in a ...
0
votes
1answer
81 views
meta_query returning excluded result
I have a series of day slots per location, in a multicheckbox custom field. I have a search page where the user can select location, weekday desired, and activity type. Right now I just have 2 ...
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 ...
1
vote
1answer
173 views
Meta_query with or without value
I am using WP_Query to sorting the post by user input. The input contains meta value which is display in select type field.
Normally when there is value inserted into the form, the wp_query working ...
1
vote
0answers
189 views
filter custom field values $min $max
The user needs to query posts by entering a $minPrice, $maxPrice and a category value.
Here is my query which returns no results:
function result() {
$result = array(
'cat' => ...
1
vote
1answer
103 views
Query by multiple meta elements not seeming to work - wordpress is timing out
Trying to run a query that pulls:
get me 4 posts or pages that are not in sticky_posts and have (my_featured_post = 1 AND photo-image_post_id > 0) OR (my_featured_post = 1 AND photo-image_page_id ...
1
vote
1answer
209 views
WP_Query() show posts that end later than today
I have a query as follows:
$wp_query = new WP_Query( 'meta_key' => 'end_date', 'meta_value' => 'today', 'meta_compare' => '>=', 'post_type=vehicle' );
I want to show only those posts of ...
1
vote
0answers
292 views
filter search custom field query
I'm looking for way to filter search results.
This is what I have so far
a custom post type of "doctors"
in each "doctor" post, there are numerous custom fields (male or female, location, ...
0
votes
3answers
74 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
950 views
How can I create a meta_query with an array as meta_field?
Here are the args for my query :
$args = array(
'post_type' => 'news',
'meta_query' => array(
array(
'key' => 'topics',
'value' => 'sports',
...
3
votes
2answers
649 views
SELECT max(meta_value) FROM wp_postmeta WHERE meta_key='price'… stops working when value is over 999
Overview: I am not trying to return a post. I simply want the single highest value for a particular meta_value across all posts... just the value itself.
Details: I have added a custom meta_key ...
1
vote
1answer
348 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
3answers
97 views
Delist entries in the_loop
I am trying to add a delisting feature to my WordPress network. Posts which are delisted would not appear in post lists, but would still be visible if accessed directly.
I've written a plugin that ...
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 ...
1
vote
2answers
450 views
WP_Query not working as expected for attachments and custom meta_query
If I use get_posts() like so I get a number of results with the value 1 for the my_key meta_key:
$posts = get_posts(
array(
'post_type' => 'attachment',
'meta_key' => ...
1
vote
2answers
156 views
How do I find if a page has a template?
So I'm doing a query like this:
$the_query = new WP_Query( array( 'meta_key' => 'homepage', 'meta_value' => 'yes',
'post_type' => 'page', 'orderby' => 'modified', 'posts_per_page' ...
2
votes
1answer
232 views
How can I query all users who registered today?
I'm trying to use meta_query to return all users that have registered today :
$args = array(
'meta_query' => array(
array(
'key' => 'user_registered',
...
0
votes
1answer
246 views
Excluding posts by meta, and also keeping posts without the meta
edit: Think I managed to figure it out, check the answer right under here, or click the following link:
http://wordpress.stackexchange.com/a/51175/15809
I've been trying to find a way to exclude ...
0
votes
2answers
907 views
Use have_posts() with array of post results retrieved by $wpdb->get_results
I don't know if I'm retarded, crazy or just plain genius or not, but I've decided to use tags as a way to link content site-wide (a big ol' many-to-many relationship website for archiving various ...
0
votes
1answer
274 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
1answer
284 views
Displaying posts with only upcoming dates according their custom field date value
I got posts that have starting date as a custom field value. I'm displaying few of those posts in my sidebar in ascending order so that the post with closest starting date is shown first. This is what ...
1
vote
2answers
441 views
Using Query Posts With Multiple Post Types And A Taxonomy
I am developing a site that has two different custom post types; one of them is called Articles and one is called Sketchpad. Sketchpad is user submitted content that is assigned a custom taxonomy term ...
