0
votes
0answers
35 views

Add custom fields meta_query to wordpress search function

I'm trying to extend the wordpress search function to include custom fields using the pre_get_posts filter: function test_custom_search_query( $query ) { $adv_custom_fields = array( 'field_1', ...
0
votes
1answer
25 views

meta_compare not comparing whole integer

I have submitted an integer data via a form to my custom search page. I can get values properly if the input is single char (e.g. 1 ) but if the input is multi char (e.g. 100) it still compares ...
1
vote
0answers
15 views

2 weeks ago from meta query meta value

This is my meta query within my posts query. 'meta_query' => array( array( 'key' => 'rw_membership_ends', 'value' => ??????? ...
0
votes
1answer
71 views

Using WP meta query to show custom post types by a start and finish date

I have a custom post type called 'events', I have a page which displays events by each month. Each event has a start_date and finish_date custom field (using advanced custom fields plugin) which ...
0
votes
1answer
21 views

Two queries – one with checkbox ticked, one without – comparing meta_query

I am trying to do the following: Two queries 1. Get all people that have director 'yes' ticked 2. Get all people that don't have director 'yes' ticked I have the first query all set up and works ...
0
votes
1answer
47 views

Programmatically set 'meta_query' for filter

I am trying to set 'meta_query' programaticaly for a filter which is supposed to filter a custom post type depending on the existence of a metakey. I have tried several ways, which I have left in the ...
-1
votes
1answer
54 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
vote
1answer
73 views

WP_Query using meta_query with relation OR and orderby meta_value doesn't work

I've been bashing against a bug for a few hours now, and can't seem to find my error. Could there be a bug with the relation type 'OR' in WordPress? $evenements = new WP_Query(array( 'post_type' ...
0
votes
3answers
91 views

Custom Query With Multiple Meta Key Value

I am new with WordPress development and I have found this query and I want pass multiple key and value in this query. My Query is: $querydetails = " SELECT wposts.* FROM $wpdb->posts ...
0
votes
0answers
31 views

meta_query compare not working

I'm trying to run this WP_Query on tag.php, and it doesn't seem to work. $tag = get_query_var('tag'); $args = array ( 'tag' => $tag, ...
0
votes
0answers
22 views

Sort posts in dashboard using custom field; also include posts where field isn't set

I'm using a pre_get_posts filter found on this question thread here, to sort a custom post type in the dashboard: function xyz_event_sort_order( $wp_query ) { if ( is_admin() ) { ...
0
votes
0answers
32 views

Orderby custom date fields with meta_query broken on OR relation

I have an 'event' post type that has custom start and end date fields. In a block on the home page, I'm trying to show only upcoming or ongoing events. So, to achieve this, I'm doing a meta_query that ...
0
votes
1answer
36 views

Passing conditional arrays to WP_Query() [closed]

I've looked around at a few places and could not find an answer. I was wondering what the best way to create a WP_query from possibly empty variables were. I have about 16 of these $_GET variables. ...
0
votes
1answer
32 views

query post based on comparison

Each post in my site can be rated as 'good' , 'ok' , 'bad'. The values are stored in custom fields. I now need to show top 10 posts with maximum 'good' and it should not display posts with greater ...
0
votes
0answers
15 views

How to get from a query an array of post names of a particular custom post type? [duplicate]

I need to get an array of post names (not titles) of a particular custom post type from a query. How to do this? My query: $query = new WP_Query( array( 'post_type' => 'fpps', 'post_status' => ...
0
votes
0answers
23 views

Wordpress Query Default Order if Meta Values Same?

If the main query args look like this: 'orderby' => 'meta_value_num', 'meta_key' => 'price', 'order' => 'DESC' What orderby does the query use if the meta_key value is the same for ...
1
vote
0answers
73 views

WP_Query with meta_query dosen't return results

I am trying to get list of posts filtered by fields I added using the advance custom fields plugin. I have more fields that I want to use but it doesn't work as I want it to. Here is what the query ...
7
votes
1answer
145 views

Mixing regular and custom post types (with meta_query) on home page

Not sure how to achieve this. I'm trying to mix standard posts and custom posts on a site homepage but I only want to display the custom posts if a meta value is set. Displaying the posts works fine ...
0
votes
1answer
300 views

How to create/modfiy WP_Query to search in post title OR custom field?

I need to modify or create a WP_Query that will search for a search term in both the post title OR a custom field (called 'my_field'). I have been reading and trying for hours, but I am right back to ...
0
votes
1answer
55 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
61 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
88 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
72 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
1answer
26 views

WP Query / Meta Query [duplicate]

How can I use a meta query like this: >>>>>> KEY_X Conditional IS ABSOLUTELY REQUIRED <<<<<<<<<< array( 'key' => ...
0
votes
0answers
78 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
59 views

Meta Query for specific months

I have a custom field which stores a date in a timestamp. I want to run a query that display posts based on the month, for example all entries from March, the specific day or year doesn't matter. I'm ...
0
votes
2answers
37 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
121 views

Can't sort order of wp_query with 2 meta keys

I'm trying to display custom post types by excluding the sold ones but also by displaying them in alphabetical order from the county meta_key. I'm trying to use pre_get_posts but I'm not sure that ...
0
votes
1answer
631 views

exclude custom post type by meta key in wp_query

I'm trying to display a custom post type (properties) and exclude posts that have a certain meta value (sold). Is there a way that I can do this? I have this for my code so far: ...
0
votes
1answer
87 views

Ordering a mysql style datetime stamp with meta_query

I have a custom post type field that I am storing data in called football_game_datetime. Example format and values for this field are examples like: "2013-10-31 14:00:00", "2013-09-16 20:00:00", ...
0
votes
1answer
423 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++) { ...
1
vote
1answer
266 views

How do I create my own nested meta_query using posts_where / posts_join?

Some of my posts (not all) have a price as a meta key/value. Today I use the pre_get_posts action so that my users can search for prices that are between a certain value. This is the code that I'm ...
0
votes
1answer
138 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', ...
1
vote
0answers
79 views

Possible to filter custom post type with multiple meta data?

I'm wondering if it's possible in one loop to accomplish what I need to do. What I would like is to sort all custom post types by the meta data of county and put them in order which it is doing here. ...
0
votes
1answer
101 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
1answer
225 views

Why doesn't my WP Meta Query return any results?

Is it not OK to accept a value from $_GET as the key in a WP Meta Query? I'm not sure why this code doesn't return any results... BOTH the queries for Price as well as bedrooms do not return any ...
0
votes
1answer
277 views

Query multiple meta values

I'm working on a 'checkbox filter' to query posts by checked values. See this link (EDIT: As you can see there are just 2 posts in this link, as soon as the user checks for 'MINI' it gets a good ...
0
votes
1answer
310 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 ...
0
votes
2answers
227 views

Event with multiple dates, display events chronologically

I've been breaking my head over this for days now and can't seem to figure it out (with the limited knowledge I have). I want to achieve the following: I have a custom post type 'Events'. Each event ...
0
votes
0answers
222 views

Using a query to display custom post types based on ACF post_object

Basically the set up I currently have is two sets of custom post types which are: uc_university and uc_course I'm having lots of trouble trying to display a course based on a my Advanced Custom ...
0
votes
2answers
109 views

Query posts by searching for a string in a meta field

I'm trying to see if I can make this happen with the built-in meta_query function. I'm taking a $_GET variable and want to return posts that contain that string inside the meta_key urls. So far, the ...
0
votes
1answer
58 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
109 views

Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months

I have a post type that holds a custom meta field with a date in it. The date is stored in the format: yyyymmdd. On the archive page for this post type I want to create 12 separate containers, one ...
0
votes
3answers
253 views

Undefined property: WP_Query::$post

I am working on some rather elaborate comparisons between metadata and having a bit of trouble correctly referring to results from my query. The first query to establish $team_is_home works fine but ...
2
votes
2answers
550 views

Sorting: custom query with orderby meta_value_num THEN by title

i try to run a custom post type query to match following criteria: sort movies first by year in descending order, after that ("inside" the year order) by title alphabetically. desired output: ...
0
votes
1answer
218 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 ...
1
vote
2answers
500 views

Optional Meta Query

I have places stored as posts in WP's posts table. I am doing some geo-locating using Geo Data Store (http://wordpress.org/plugins/geo-data-store/). This is working great for me, as I can currently ...
1
vote
1answer
346 views

Query by meta_key and order by meta_value_num return orderby date

I'm trying to use the orderby and custom WP_Query features of wordpress. It works nicely to select item by their meta and to order by date. Unfortunately, it seems that I could not get the post ...
0
votes
1answer
449 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', ...
1
vote
0answers
59 views

database query with more than a couple meta hangs and doesn't complete

I have a development website with about 70 checkboxes for custom fields. The idea is the user selects one or more checkboxes, it queries the database for all posts that have a meta_key for the ...