"wp-query" ambiguously refers to one of two things. 1) WP_Query is a class native to Wordpress which allows users to query the posts database using a number of criteria. 2) $wp_query is the default object that holds the main query object on each WordPress page.

learn more… | top users | synonyms

0
votes
0answers
48 views

Meta Compare (EXISTS) does not work

I want to include the posts that have a certain meta_key and exclude those that does not have that meta_key. NOT EXISTS works but EXISTS fails in the code below. function include_meta_key( $wp_query ...
0
votes
1answer
73 views

tax_query showing no results

I'm creating a music database site with two custom post types: tracks and albums. I've linked the tracks to their respective albums with a custom taxonomy for the album's slug. On each album page, I'm ...
1
vote
1answer
50 views

WP_Query post_parent parameter always returns children of current page

Well the title gives it all away... Here's the code: $args = array( "post_type" => "page", "post_parent" => $cat, // runs through a loop of 5, 128, 130 "posts_per_page" => -1 ); ...
0
votes
1answer
46 views

List of ways to access WordPress database?

I'm trying to get a complete understanding of how WordPress works with databases. I've read the documentation but I'm getting confused by all the different approaches available. So far my ...
3
votes
1answer
80 views

WP_Query to work with custom view

I have created a Database VIEW on wp_posts which selects its all columns and exposes an extra calculated columns (average). So my View is identical to wp_posts plus one column, which I want to use for ...
0
votes
2answers
23 views

getting content from main domain to sub-domain using category and WP_Query

I have a main website with 2 sub domains. www.example.com www.space.example.com www.products.example.com I want to publish articles on my main website using categories to sort them. for example, ...
0
votes
0answers
55 views

More efficient query to display posts in same sub-category?

[EDIT: See my comment below, I may have been fooled by Chrome caching an earlier version of this code. It now seems to run quite quickly. Leaving the question up in case anyone sees a better way but ...
0
votes
1answer
39 views

How to query posts with current or future date only

I want to only get posts with current or future dates, to show upcoming events. Current arguments: $args = array( 'post_type' => 'event', 'meta_key' => 'event_start_date', ...
0
votes
0answers
41 views

Post type archive pages with custom query

Apologies if this is something trivial, but I can't seem to get it right and I can't quite find the correct way to tackle this from previous questions. I am building my own theme. I have the normal ...
0
votes
1answer
50 views

WP_Query freezing

So I have stumbled across a number of similar questions on SO, but my understanding of wp_query and advanced PHP is limited. I think I am getting lost in the PHP objects / arrays and the use of ...
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
0answers
43 views

Bare-bones WP Query location search

I need to develop a Wordpress query that filters a custom post by zip radius. I'll be using ACF Google fields to store the location of each custom post type. Here's where I am thus far. Wordpress ...
0
votes
1answer
26 views

Query by key or author

So right now my query looks like this: $allsearch = &new WP_Query("s=$s&showposts=-1"); I understand what this query does and it works, but not I want to add the ability to query posts by ...
0
votes
0answers
23 views

Running posts thumbnails in flexslider

This is what i'm trying to achieve: Front page with 10 posts, with three first posts shown in a slider (flexslider) and the rest shown as regular excerpts underneath it. Ive managed to do it, this is ...
0
votes
1answer
38 views

Loop doesn't exclude the specified category in home page

Oh, hello! I want to show the three most recent blog posts in the home page, excluding the "featured" category, which has the ID 8. In order to see the ID for that category, I went to Posts > Category ...
0
votes
1answer
27 views

How do I display posts with specific value in a custom field into my loop?

I'm trying to display posts that contains a specific value from my custom field. For example, I created a custom field that asks for the year, let's say I would like to display only posts with the ...
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
23 views

Getting duplicate results from query

I'm confused as to why I'm getting duplicate posts showing up in my code for two related blog posts (by current category). The secondary posts are showing up outside the intended div, and not even ...
0
votes
1answer
30 views

post_per_page ignored in WP_Query

I have a custom post type named 'album' and I added two custom fields 'release_date' and 'release_date_us' with the ACF plugin. I'm trying to display the latest albums based in a widget area. The ...
0
votes
0answers
6 views

Filter get_projects_category();

Is it possible to amend the <?php get_projects_category(); ?> to only get projects from specific categories? The previous code is populating a menu with category links, and I only want certain ...
0
votes
1answer
27 views

Get posts with multiple categories

How to get just the common posts of 2 different categories? consider this category tree: posttype -news -arrangement --course --competetion --other region -region1 -region2 -region3 Now I want to ...
0
votes
1answer
52 views

category__in not working on custom post type

Can't get my WP_Query loop to work, cannot figure out why category__in won't work. Just want to pull certain categories FROM my custom post type $args = array( 'post_type' => 'bbt', ...
0
votes
2answers
40 views

Change query from cat id to slug or name?

I'm using the following query to fetch posts in a category (10). I would like to change this code to use the category slug or name instead of the id number as this often changes when I move sites ...
1
vote
1answer
57 views

Query wp_usermeta alongside wp_users

I want to use the WordPress query functions and no external plugins for the task. Here is what I have so far: add_filter('user_search_columns', 'user_search_columns_bd' , 10, 3); function ...
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 ...
0
votes
1answer
25 views

Page displaying 1st post from a range of custom tax?

Is it possible to have a page display the 1st post from each category from a custom taxonomy? e.g custom tax called gallery-section, within that it has a range of categories, i.e Gallery 1, Gallery 2 ...
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 ...
0
votes
2answers
99 views

Get post ids from WP_Query?

Is there a way I can retrieve an array of post ids queried from the following: $latest = new WP_Query( array ( 'orderby' => 'rand', 'posts_per_page' => 3 )); if ( ...
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
33 views

$wp->query_vars redirection giving me error

I am using plugin which is working based on short code.And I want to redirect to one template for single location. And I have given href like this to the plugin- ?wpsl-id= So basically what I have ...
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
2answers
60 views

get_posts query matches too many results

I have a query inside a function that is returning matches that i don't want, for example when the $id=116 it is also returning results where the meta_key 'funds_id' is 11687. public function ...
0
votes
0answers
26 views

Can I use pretty URLs for paramaters without query_vars?

I have a plugin that retrieves data from custom non-WordPress tables. I'd like to be able to add pretty URLs to retrieve the data, but as far as I can tell, if I use the add_rewrite_rule and ...
0
votes
0answers
23 views

query wordpress page template

I'm making a one page template and have a menu set up to control the pages that are being displayed. I want to query the pages from the menu, however include the template with all the page data (php ...
0
votes
0answers
20 views

Post returns wrong result when adding Arabic parameter to WP_Query

I have a WP_Query which works perfectly when I use an English parameter like this: $the_query = new WP_Query( 'tag=english param'); but when I add this: $the_query = new WP_Query( 'tag=arabic ...
0
votes
2answers
56 views

Efficient way to update multiple post meta

I have managed to update post meta using update_post_meta(). However, the more posts I have, the more time it takes. I would like to minimize the time it takes to process say about 400 posts (although ...
0
votes
2answers
47 views

Combine privileged users array with my current query

I have a custom page template with the following query. Isotope filers my categories and all this works fine. I want now to make this page only viewable by a few specific, currently logged in ...
0
votes
2answers
113 views

How to get post id of static front page?

I'm trying to use the front page as a default of sorts for featured images (if no featured image is set, I want to use the front page's, for example) But I'm having trouble finding out how to get the ...
0
votes
2answers
42 views

Pagination not working in secondary query

I'm trying to fix a theme which has the following setup: on each page the user can select to list posts instead of the page content. The problem is that the pagination doesn't work on this page even ...
0
votes
0answers
53 views

Show sticky post before other WP_Query

$recent_posts = new WP_Query( array('posts_per_page' => $blog_num_posts, 'paged' => $paged, 'post_type' => 'post', 'post_status' ...
0
votes
0answers
38 views

Sort order not working properly with meta_query

I have a template that pulls a custom post type for properties and sorts them by state. The script works properly until you add in a meta_query for the agent. It pulls the correct properties, but it ...
0
votes
1answer
40 views

ajax wp_query conditional tags not working

I'm trying to ajax wp_query, I got success getting posts for home page with the following code. Then I added conditional tags to modify the query for the other pages like Category page the problem ...
0
votes
1answer
37 views

Sort by custom field that is an array?

is it possible to sort posts inside a query based on post value that is in an array - but using the last element of the array? The code looks something like: <?php $mostsharedposts= new ...
0
votes
2answers
49 views

Custom taxonomy wp_query woes.

Here's a brief outline of the set-up: "The Art" CPT is where all the art and art descriptions are uploaded. In this CPT you can choose the category (custom taxonomy) of the art--painting, jewelry, ...
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 ...
1
vote
1answer
39 views

Date query not inclusive despite parameter being true

I've set up a small test query to get some posts from October 1 to October 10. I published a post today ( October 10 ) and with the date query parameter of include set to true, I would have expected ...
0
votes
0answers
15 views

Do not count menu items in posts_per_page

Custom type posts are added to query for category page: function test__pre_get_posts( $query ) { if( !is_home() ) { if( is_main_query() || is_category() ) { $query->set( 'post_type', ...
0
votes
0answers
44 views

how to show a tooltip include of thumbnail and excerpt when hovering a post link in other post?

Is there any way to call thumbnail and excerpt for link of post in another wordpress post? For example when i hover a post link in other posts, it shows a tooltip include of thumbnail, excerpt. Like ...