"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
24 views

What is wrong with my WP_Query Arguments?

In my single.php file I am using a nested WP_Query to show more posts, at the bottom of the page. My code for the query and nested loop are as follows: <?php $ep_args = array( ...
0
votes
2answers
38 views

WP_Query a custom field value bringing back 0 results

I am trying to do a query to grab all the pages that have the tickbox checked "feature_on_front_page" which has the value "featured" with label "Featured". I added this checkbox with ACF. My query ...
0
votes
1answer
27 views

Search Functionality broken by the wp 4.2 update

I run a blog site with posts by authors, and I implemented a search that would return results if the search was like an author's name or the search term was contained in a story. I was functioning and ...
0
votes
1answer
7 views

Displaying All Data from Custom Post Type Fields through Advanced Custom Fields

I have looked all over Google, trying to figure this out. I've made some progress but still stuck. I'm pretty new to ACF and custom post types. I have a custom post type of "Attorneys" that I setup ...
0
votes
1answer
440 views

WP_Tax_Query with post_tag not working

Using the pre_get_posts hook, I'm trying to allow users to narrow down their search by limiting it to posts with certain (multiple) tags applied. This is my hook and function: ...
1
vote
1answer
639 views

Auto Populate Custom Field with Complex Value That Increase by One?

Can somebody help me to sort this? I am using WP 3.5.2 and I have "Orders" post type where purchase_order custom field is located. This is the sample of purchase order record: POCOS20130051 PO - ...
0
votes
1answer
30 views

Accessing GET variable named 'error'

As part of a project I'm required to make a wordpress plugin which integrates with Google for authentication (There are good reasons for developing a new plugin instead of using an existing one). If ...
1
vote
5answers
523 views

Pagination for blog posts reloading same page

Symptoms Visiting /blog/ loads the first 10 posts, as expected. Visiting /blog/page/2/ (and onward) loads the new URL but with the same 10 posts. Nothing changes but the URL. Setup Details Custom ...
1
vote
3answers
666 views

How to use the_posts_navigation for wp_query and get_posts?

WordPress have the_posts_navigation function since 4.1.0. But I don't know how to use with wp_query or get_posts. the following code is in a template file of page.wp_query method: <?php if ...
0
votes
0answers
12 views

Filter meta data for simple and variable products on custom query

I have a custom query loop on a page using WP_Query and I want to filter by certain meta keys _price, _weight, _width, _height, _length, total_sales. I am able to get this working with both simple ...
0
votes
0answers
9 views

Combine WP_Query results with new WPDB->get_results Query

Is it possible to combine results from a WP_Query array with results from a new WPDB get_results() and use the loop to loop through the results? Essentially, I am trying to modify a shortcode that ...
0
votes
1answer
13 views

WP_Query function for custom post type

I've got a CPT for random homepage banner images (so we can test different images and call to action language). I've got a custom field for the post type that accepts a specific ID for each banner so ...
0
votes
2answers
25 views

How to display specific ids of posts using wp_query?

I have 7 services in a page. All 7 services have featured images. I want to show all the 7 images and content in a slideshow. $args = array( 'post_type' => 'page', 'post__in' => ...
0
votes
1answer
471 views

WP_Query post at custom position

Lets say I have a custom query which based on two custom post types: $wp_query = new WP_Query(array( 'post_type' => array('post-type-1', 'post-type-2'), 'post_status' => ...
0
votes
0answers
23 views

How to Add Meta Values in Loop?

I am using a category page to list various businesses on a website. These businesses have reviews attached to them through posts that contain their unique tag. I want these aggregated rating reviews ...
0
votes
0answers
18 views

WP_Query and Pagination on a Static front page (Extending Visual Composer…)

For the past two days I've been trying to debug an issue with WP_Query() and Pagination. This website I'm a dev for uses a Wordpress theme (Salient by ThemeNectar) that includes the visual composer ...
0
votes
0answers
16 views

Sort using custom fields when empty [on hold]

I have the following problem: I am working with WordPress to create a homepage for a client, now I am at a specific problem, that there are custom fields and the posts need to be sorted using those ...
0
votes
0answers
11 views

Is it possible to combine multiple category__in arguments?

I want to produce a query that returns posts which are in one array of categories and also in another array of categories. So, if my two arrays are: $offices = Array ( [0] => 73 [1] => 74 ) ...
1
vote
1answer
524 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
0answers
20 views

Override default posts per page in taxonomy template

I am using the following code to show ordered list of posts in taxonomy page: <?php $mypage = (get_query_var('paged')) ? get_query_var('paged') : 1; $ppp = get_query_var('posts_per_page'); ...
0
votes
0answers
14 views

Ordering by custom post meta key

I'm using the plugin WP Job Manager, and have a custom field with the meta_key "rating". I want to be able to order listings by rating, using "orderby". Normally for posts I imagine it would be ...
4
votes
3answers
144 views

Better way to get tag stats?

I have over 4000 posts. I am trying to query all the posts and get the count of tags each post has and sum up posts count based on number of tags the post has in dashboard. The posts count shows up ...
1
vote
1answer
92 views

Any number in meta key (wp query)

I have such a query. The field modules_%_text is advanced custom fields flexible field where % should stand for ANY ROW number, it seams that it should work like that, however it's not. What i'm doing ...
0
votes
1answer
12 views

Filter custom post type by custom taxomony

I have several custom post types, each with one or more custom taxonomies. I'd like to add a filter for each taxonomy to the relevant custom post type edit screen, but my solution is not working. ...
0
votes
1answer
2k views

wp_query->max_num_pages always returns 0 on custom post type

Hi there I am developing a theme where I have to load some posts with ajax, in my index page everything works properly, the problem is when I need to use it on custom post type, I pass the values for ...
0
votes
1answer
1k views

forming WP_Query for posts of all post types but from specific categories

I need to get post from blog, custom post type 1, custom post type 2. custom post type 3 and either from category 1 or category 2 or category 3 or category 4 or category 5 or category 6 or category 7 ...
1
vote
1answer
46 views

List only posts from specific category on category page

I wanted to ask if there is a shorter way then by checking each time if the post is coming from a specific category. As you can see the categories cover the alphabet, A B C etc and each time I check ...
0
votes
2answers
513 views

Filter post query to only show direct children of category

Google seems all purple on this subject, if you know what I mean. I've searched for this topic forever to find a solution. I want to build a finder/explorer feel to my categories, so when browsing to ...
0
votes
3answers
27 views

get_posts with multiple categories

If I do a get_posts() with category set to 1,2 I will get all posts in category 1 OR 2. If i want all posts whit both categories, that is 1 AND 2, how do I make that request?
0
votes
2answers
30 views

current_post not working - give me -1 for every post

I try to get the current post index number and echo the number of this lesson(post)in a series of lessons(category). I'm inside the loop on single.php page my code looks like this: $args = array( ...
0
votes
2answers
1k views

Featured images loop for Orbit Slider

To integrate Zurb´s Orbit Slider in my theme, I´m trying to generate this HTML with WordPress: <div id="featured"> <img src="featured-image-1.jpg" alt="the-alt-tag" ...
3
votes
1answer
33 views

WP_Comment_Query pagination, delving into the unknown

I am aiming to pagination WP_Comment_Query(). It appears this is either taboo or there is no viable information about it online, not anything. Why? Is it possible? If so, how?
-3
votes
1answer
349 views

Get all posts without tags

I'm working with a tag plugin. Is there a WordPress way to get_posts or query all posts that have no tags? EDIT I had already queried the WP Codex, search Stackexchange and Google for a related ...
3
votes
0answers
24 views

How to add taxonomy filter on the query fly?

I try to add tax query on pre_get_posts hook using following code : // Add custom posts to main query (archive and home) add_action( 'pre_get_posts', 'add_post_types_to_query' ); function ...
1
vote
2answers
1k views

Pagination doesn't work

I created myfile.php with the following content: global $paged; if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); } else if ( get_query_var( 'page' ) ) { $paged = ...
1
vote
1answer
54 views

How get posts from a subcategory of a category by name?

I'm trying to create a subcategory template of a defined category. For example, for each one, I would like to check if his subcategory Photos exists and to get posts of this. Here is my category ...
2
votes
1answer
589 views

Get Recent Posts by Date in Multisite

Everything in explanation is about CDTuts I've created a WordPress Network and I want is to get the recent posts from all of the selected subdomain blogs. I need to get the latest All organized by ...
0
votes
1answer
20 views

Get posts associated with custom taxonomy alternate way

I have a custom post type named artwork and I'm trying to get all of the artwork that is associated to the custom taxonomy of artists on the taxonomy-artists.php page. I found an example here which ...
4
votes
1answer
144 views

Is it possible to orderby multiple meta_keys when using meta_value_num?

Reading through the order & orderby documentation, it's not clear to me whether there is any support to order based on multiple meta_key values. Obviously, using meta_query I can return posts ...
0
votes
1answer
728 views

Custom WP Query from meta_value stored as serialised array

I'm using a Magic Fields 2 multicheck box to store Services which can be assigned to Case Studies. The data is stored as a serialised array in WordPress, and I need some help to extract the "related ...
0
votes
1answer
773 views

wp_query orderby random do not repeat infinite scroll - one loop

I have found a lot of documentation on solving this issue with multiple loops, I'm finding it hard to see a solution for one custom loop. Problem: I'm using infinite scroll to load in the next page ...
0
votes
1answer
758 views

Search.php - return number of results but cannot loop through

I have a following search.php page (this is just the code required for problem presentation). Why is my $total_results returning a number of posts found, but when I do a loop though it always print ...
1
vote
2answers
440 views

Loop to fetch 3 post_thumbnail instances from 3 most recent custom post types named “portfolio”

I am trying to display 3 post_thumbnails from a custom post type "portfolio" on my homepage template. So one from post 'A' , one from post 'B' and one from post 'C' The image from post A will be set ...
1
vote
1answer
623 views

wp_query for displaying attachments with a tag

So I am running the following query: <?php $args = new WP_Query(array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'oderby' => 'title', ...
0
votes
1answer
41 views

Display post list within category list sorted by name [duplicate]

I'm trying to display a list of categories sorted by name and all posts of each category inside it. Like this: Category A Post B Post F Post Z Category B Post A Post C Post G Category C Post D ...
0
votes
1answer
954 views

WP_query - Filter by tax_query and meta_query using multiple select

I have a Publications Post Type, a Writers Taxonomy and a Publications Custom 'Meta Box' Value; parent_id. In my archive-publictions-post.php template I am trying to filter the WP_Query Class, with ...
14
votes
8answers
14k views

meta_query with meta values as serialize arrays

I'm working on a project in which I'm creating a custom post type and custom data entered via meta boxes associated with my custom post type. For whatever reason I decided to code the meta boxes in ...
1
vote
1answer
435 views

Pre_get_posts Gives 404 on Custom Post Type

I'm trying to filter the query on a sub page called "Ask Question" to list all of the recent questions submitted by users, but I get a 404 when going to the page. Flushing the permalink structure did ...
0
votes
1answer
22 views

How to convert query sql to shortcode in wordpress?

I want to make a shortcode like this [myshorcode:2:drinks], and query-wrangler I have managed to get the following query that shows me 2 products of a certain taxonomy PHP WP_Query: $query = array ( ...
1
vote
1answer
601 views

Multiple keyword search

I have a custom search where I want to enter a keyword or phrase into the search box, and then by pressing enter it adds it to a 'search storage' (already coded, see below). Asume I have 3 posts, one ...