"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
1answer
306 views

Make WP_Query more efficient?

Ok - so using a WP_Query to count votes by a user. But now there are 23,000 votes and its using up lots of memory. Is there a way i can make this WP_Query more efficient? $args = array( ...
0
votes
1answer
182 views

Cannot query custom post type taxonomy from theme options array

I am having no luck with querying a custom post type taxonomy from an array in theme options. My full code is below, would be grateful for some feedback to get it working correctly as I cannot get ...
1
vote
1answer
122 views

Best Practice For Querying Grandchildren?

Objective: Query and loop through a page's third-level "grandchildren" in a way that allows pagination. Here's the code that I'm using (pagination excluded): // Get the ID of the first ...
0
votes
3answers
288 views

Listing all custom post types using a specific term on the said term's template page, in groups

I have a custom tag-like taxonomy called PEOPLE registered to all post types - both the default and custom ones. I have created a template for a single term named taxonomy-people.php and I'm ...
0
votes
2answers
194 views

tax_query not working in template

I have a custom post type called 'product' with a registered taxonomy 'product-type'. I want to display all post from a particular taxonomy from custom post type. In my case I want to display all the ...
1
vote
1answer
500 views

How to display 7 most recent days of posts?

I would like to be able to display on my homepage a timeline of posts from 7 of the most recent days. For example, if today is January 1, 2013, I would like my blog feed to display something that ...
0
votes
1answer
309 views

Custom page template query_vars

I created a custom page template movie-page.php and a page movie in WP. The template shows fine when I visit site.com/movie/ I want to add movie_id as a query var. Here's my code: ...
0
votes
1answer
1k views

Query by post title

I've used a custom post type for one of my website. Custom post type contains scratch card data along with some custom fields. I've developed an android application to manage those items from android ...
0
votes
1answer
5k views

Why WP_Query('showposts=5') shows only 1 post?

I am trying to do a simple query to get the latest 5 posts into an unordered list, but this is only showing 1 result even though I have several posts. I even did an offset, but it shows the next post ...
1
vote
1answer
479 views

WP_Query posts by distance based on LAT & LNG in Database

I've got table in the WordPress database that has lat & lng stored and I'd like to add a sort feature on the results page 'Sort by Distance' that gets the locations that are closer to your ...
3
votes
2answers
2k views

Custom post type archive 404's with paginate_links

im using paginate_links function to create pagination on my custom post type archives, no matter what i do im hitting 404 errors when going to view page 2 (ie clicking to go on one page in the ...
-1
votes
1answer
87 views

why do drafts return as part of wp_query?

I have some code as plugin, which I call via AJAX from a page one the site. It gets two drop-down values and uses them in tax_query to fetch some posts. Question: why do drafts return amongst results ...
1
vote
1answer
144 views

WP_Query Variable inside Array

The array below with "'taxonomy' => 'age'" isn't working, if I copy and paste the array "array( '19', '20' )" in place of the variable it works fine. I just started picking up PHP so go easy on me :) ...
0
votes
2answers
819 views

exclude a post from wp_query loop

0 down vote favorite I show my last post in a page with this code: $query1 = new WP_Query(); $query1->the_post(); and it further with: $id = $query->ID; to retrieve last post ID so I ...
0
votes
1answer
175 views

filter the_content, custom post type, and wp_query

I thought this was going to be quick and easy, but naturally it's turning out to be more complicated. I'm writing a simple plugin that creates a custom post type "Ad", and then puts a random ad at ...
0
votes
1answer
41 views

Reordering content using a meta value

I've got this theme where you can add posts of type "portfolio", and I want to be able to reorder them up. I've added a custom meta field called "position" and I've set already those values. All good. ...
1
vote
1answer
288 views

Pagination 404 errors for author posts query on author.php

I'm trying to query all posts by an author and paginate them on the author.php page. I've tried messing with the WP default blogs per page settings and that doesn't help. I've looked at other posts ...
0
votes
1answer
242 views

Only display posts that are in multidimensional meta_value

So i want to retrive a list with the posts that are in the meta_key "_blocks" and in that there is a multidimensional array with "areas" called left, right ,top etc. And within them there are assigned ...
0
votes
2answers
239 views

Multiple Categories under one URL, where 'Front Page' is used already

I couldn't find an answer relating to this, maybe I just didn't come across it yet. So the setup of the site I am working on at the moment: The Front Page is not set, is default. I can't change this ...
2
votes
2answers
300 views

Given a WP_Query, how can I get a list of tags?

I have a new WP_Query that I use to generate a custom loop and display a set of posts. One of the things the query does is provide pagination. Before I display the queried posts though, I'd like to ...
0
votes
1answer
54 views

Loop being strainge

So I hacked together a function that does the following: protected function _query_post($query){ $original = $this->_wp_query; $wp_query = new WP_Query($query); ...
2
votes
1answer
2k 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
2k 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' ...
1
vote
1answer
77 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 ...
0
votes
1answer
152 views

Custom post-type custom query - show all posts

I've got a taxonomy archive to show custom post-types, its got a custom query calling the posts - I can't figure out where to put showposts in it. global $wp_query; $term = get_term_by( 'slug', ...
-1
votes
1answer
91 views

Trying to WP_Query a category

I am trying to output all the posts of a certain category but all that is happening is The page content is being outputted no posts? template page <?php /* Template Name: Blog */ ?> <?php ...
6
votes
1answer
2k views

WPML with WP_Query serving up all 3 languages [closed]

I've got something about this on the WPML support forums, but I figured I could ask here as well. Here's the important info: I'm running a WP Multisite setup with custom post types, custom fields, ...
2
votes
2answers
1k views

Why Does get_posts() Return an Empty Set?

I'm writing a custom plugin that is initialized at init. This plugin is trying to query for some custom post types already stored in the DB. Here's my code: $args = array() $myposts = get_posts( ...
1
vote
2answers
2k views

How do I query all posts of one type across my multisite installation?

I have a multisite wordpress installation with 5 sites, and within each site there are the same 4 custom post type, I want to query the latest 5 posts across all sites where the post_type is gallery ...
0
votes
1answer
225 views

Display 3 posts with different HTML markup using a loop

I want to be able to display 3 posts from the same category on my index.php page, but due to the way my site's HTML/CSS is coded I'm having some difficulty understanding the correct way to go about ...
1
vote
1answer
60 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 ...
0
votes
1answer
264 views

Tax_Query using WP_Query not working

I cannot get this query to work properly. It just renders one post even though I have three posts that are categories in the 'Firm News' and 'Test' categories. Can anyone see a problem with my code? ...
0
votes
1answer
355 views

How can i list random post from multiple category?

I have an author page, and I want to list posts from current author's categories. e.g. I'm viewing John's page, and John wrote in Sport, Tech, News, Computer categories. Then my code list from this ...
1
vote
0answers
89 views

Query custom post types and a specific page?

I'm using this query WP_Query('post_type=product&posts_per_page=8') I need to include a specific page into the query but not sure how to add it since I'm only specifying the custom post type? Is ...
1
vote
2answers
2k views

Custom-Posttype & Custom Taxonomy WP_Query

I add a custom post type with custom taxonomy and i wish to get all postings into this by a template, but the result is 0 $args=array( 'post_type' => 'contents', 'post_status' => 'publish', ...
1
vote
1answer
393 views

Recommended way to drop a pending query (in pre_get_posts)?

It looks like an e-commerce plugin's core query will be of no use to me in one particular template so I would like to discard it completely in favor of my own WP_Query loops in the template. It's not ...
3
votes
1answer
152 views

Search widget breaks when using multiple loops?

I have created wordpress template that uses two loops via WP_Query object. Everything works fine except Search widget. I've been pulling my hairs out for three days now Googling like a madman,but ...
0
votes
1answer
712 views

how can i change WP main archives loop to sort by name or title

I've got the following code which i found somewhere else i use it for pagination. I don't understand all of it although I've read codex.wordpress.org/Class_Reference/WP_Query several times. they ...
0
votes
1answer
464 views

Wordpress SQL JOIN query

Hi Im trying to run 2 querys in the same query call. // send the query global $wpdb; $commentQ = "SELECT * FROM $wpdb->comments " . $whereClause . $orderBy; $comments = ...
2
votes
1answer
1k views

Page navigation doesn't show when query category

Problem: when I do www.example.com?cat=4 or choose category through custom menu or from category widget it shows only first page without navigation at the bottom, where it supposed to be. It's the ...
0
votes
1answer
903 views

issue displaying variations in custom template using WPeC 3.8.9.2

I’m having trouble displaying variations in a custom built template, each time i call the wpsc function have_variation_groups() within my loop i get the following php error ...
3
votes
1answer
176 views

How to query for a week using key => value WP_Query argument notation?

I would like to be able to query for a specific year and week using WP_Query argument notation. I am using this notation as I would like the page to paginate. What's the correct "year" and "week" ...
0
votes
2answers
206 views

How can i simulate “taxonomy__in” in query?

How can I have to set tax_query to get results like 'category__in' => array()? Specifically, I would like to show all the posts that have a term from the city taxonomy with one of these id's: $cities ...
4
votes
1answer
108 views

Tracing the life of a query

I can't find documentation regarding this - but is there a way to see how a query might bounce around from one filter to another? I've got a list of possible wp_filters and their relevance but I ...
1
vote
1answer
153 views

Custom WP_Query with complex 'post_status' argument

I'm trying to run a WP_Query() with a bit of a twist. I need to include two post_statuses and specifically exclude another. I've got WP_Query( array( 'post_status' => array( 'publish', ...
0
votes
1answer
908 views

Custom post type, custom taxonomy, query posts only from taxonomy (children of)

I have a custom post type (portfolio-type) with a custom hierarchical taxonomy (portfolio-category) Now I would like to query only posts from potrfolio-type, so i do: $paged = 1; if ( ...
0
votes
1answer
450 views

datetime picker, timestamps and meta queries

I have a custom meta box with a datepicker. The datepicker outputs 2013-01-17 10:00 in my database for an event that is 01-17-2013 at 10pm PST. $eventlist = new WP_Query(array( 'post_type' => ...
0
votes
1answer
207 views

How do I get the content of a custom instance of WP_Query?

I've taken a very minimalistic loop, and tried to modify it, so that I can use more then one loop on one page. The minimalistic loop works fine and gets the content. But my modification to allow it ...
0
votes
1answer
187 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 ...
2
votes
0answers
170 views

how do i combine keyword search and taxonomy in a WP_query $args array Worpresss [closed]

I'm trying to figure out how to get the following code to work as one wp_query . i'm trying to filter the loop on the search values and the taxonomy values: Both of these sections work independently ...