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

WordPress - Meta query with JSON value?

Im using post meta to store some value. Im having the following in wp_postmeta table: meta_key mykey meta_value a:2:{i:0;s:1:"5";i:1;s:1:"2";} I need to return posts which have meta_value of 2. ...
0
votes
2answers
596 views

WP Query - duplicated posts once including tags in search results

I running WordPress on IIS & SQL server. As some of the plugins do not work correctly with DB ABSTRACTION I am using a lot of functions.php filters as so on. To make my search results include ...
0
votes
0answers
5 views

Multiple loops on search results page return empty on no results

I've got a search results page that has several loops on it. One loop returns our most popular posts, and the other returns the top 5 of another custom post type. We use these loops on the blog, on ...
1
vote
1answer
17 views

Post loop for all taxonomy terms

I currently have a custom taxonomy set up called development-category at the moment, if I want to set up a posts loop for each of these taxonomies, I'm having to do it as follows: <?php ...
0
votes
2answers
21 views

How do I turn these values from MYSQL into an array

I am working on a custom query to show a few posts. I am able to output all the post ID's. I am trying to turn these ID's into an array so I can use 'post__in' => $myarray in my query. How can ...
0
votes
1answer
630 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
4answers
1k views

How to limit the number of posts that WP_Query gets?

I have been researching on Google and WPSE and the only thing I see repeatedly is to use showposts, that is deprecated. I am familiar with WP_Query, and I thought that if I set posts_per_page to my ...
0
votes
2answers
52 views

Show posts by author of membership level (Paid Membership Pro)

I am currently listing posts based on user role, with the following query: $ids = get_users( array('role' => 'author' ,'fields' => 'ID') ); $args = array( 'author' => implode(',', ...
2
votes
1answer
703 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 ...
4
votes
2answers
126 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?
2
votes
1answer
555 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 ...
1
vote
1answer
26 views

Display posts with date wordpress default

I'm trying to display last posts with WordPress date, not date from server. <?php $week = date( 'W' ); $year = date( 'Y' ); $query = new WP_Query( 'year=' . $year . '&w=' . $week ); while ( ...
0
votes
0answers
17 views

Get archive of posts separated by taxonomies and subtaxonomies

I'm making a website that lists hotels by region and sub-regions. I made a custom post type called Hotels and a custom Taxonomy called Regions. I've inserted countries as parent regions and states as ...
1
vote
2answers
454 views

How to display future posts - modified query still yields 404

I have a very strange problem and I am stuck. I want the single page to display posts with the post_status of publish and future. So I added this code to my functions.php in my theme: function ...
1
vote
1answer
16 views

paging in WP_Query on static page

I have a static page, and on that page I want to show a listing of blog posts. I want 12 posts per page (so I want the listing to be paginated). It's all working great, except for the pagination. ...
0
votes
1answer
362 views

How to get specific string in explode array?

I have a shortcode where I'm trying to get a specific string from the $args array below. Query: <?php $args = array( //'post_type' => $posttype, 'post_type' => explode( ', ', $posttype ), ...
0
votes
1answer
138 views

Sorting meta_value as integer doesn't work

This plugin uses the below chunk of code to print the top 10 highscores. But this doesn't get the list of top 10 scores sorted by meta_value in my WP install $scoreboard = new WP_User_Query( array( ...
0
votes
1answer
15 views

Secondary loop pagination on custom post type single post gets redirected to first page

I would like to output related posts on a custom post-type single page. Everything seems to be set up correctly. When I hover over my pagination links I see ...
2
votes
3answers
2k views

Check for featured image in WP_Query

Is there a way to filter posts by featured image when initialising a WP_Query object? Example $my_query = WP_Query(array("has_thumbnail"=>true)); or, more ideally $my_query = ...
0
votes
1answer
17 views

Set div columns in a loop by post count

I'm trying to post images from a custom post type into columns based on the amount of posts that are returned in the loop. This is my code: <?php // args $args = array( 'numberposts' ...
1
vote
3answers
459 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 ...
0
votes
3answers
386 views

Remove category from query (show all posts in archive.php) pre_get_posts()

I am using pre_get_posts() to allow all posts to be displayed on any category archive. This is because I will provide a javascript sorting and filtering method using isotope.js. Any category page will ...
0
votes
0answers
29 views

Woocommerce sort by rating [on hold]

I'm using Storefront to develop my site and i need to sort the products by rating at a specific part (using WP_Query). I tried without success the following code in my $args: $args = array( ...
0
votes
1answer
358 views

The next_posts_link() show me a aditional page in blank

The description Hi, I am using a custom post type and a loop through the values ​​I show. I'm using a term ($ term) that comes from a previous page in the loop to only show related items. Just for ...
1
vote
2answers
8k views

WP Query to get all posts (including in draft/pending review)

I currently have the following query: $args = array( 'post_type' => 'post', 'orderby' => 'title', 'order' => 'ASC', ...
0
votes
1answer
16 views

Get array of current post term ID's

I'm creating a little "Related posts" section on a site and I'm doing it based on terms in a custom taxonomy called "director". How can I get an array of term ID's for the current post so that I can ...
1
vote
1answer
743 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 - ...
1
vote
1answer
611 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 ...
1
vote
1answer
418 views

Too many posts cause slow load when paginating

I have about 10k posts and I made a page that lists all posts but it is paginated every 54posts. It gives 131 queries in 6.730 seconds which is pretty slow to load. Is there a way to make it load ...
0
votes
1answer
20 views

How to make an insert in wp_posts and use the data inside of WordPress? [on hold]

I need to do a vehicle system and would like to know how to use the wp_insert function to insert data in the Wordpress database. I must also know how to enter the meta values. Example : color, size ...
1
vote
1answer
400 views

meta_query 'compare' => 'IN' not working

First of all, I know it's a duplicate, but none of the older answers were helpful. I'm searching in posts through post_meta. Here's my code, which currently returns nothing. $args = array( ...
0
votes
1answer
269 views

WP_Query OR clause for tax_query and keywords

Is it possible to make an OR clause between tax_query and keywords? I'd like WP_Query to return posts if there is a tax_query match or a s keyword match.
0
votes
0answers
10 views

query var “p” empty on some requests | custom rewrite rules

I am moving a site from drupal to WordPress. The "nodes" on drupal have custom "permalinks" that don't follow any rules so I have added the permalinks as post meta and create a rewrite rule for every ...
0
votes
1answer
364 views

Show Posts in Vertical Tabs with Scrollbar

I have created CPT ( Custom Post Type ) called Recipes. I want to display all me recipe in Vertical Tabs. For Example; check the image below i have created. Image Example Click Here On the left ...
0
votes
1answer
18 views

WP_Query always returning the last custom post

I have code that works fine on our live system, and I'm porting it to a new theme. In the new theme, the WP_Query always seems to return the last custom post. My function is: function ...
-1
votes
1answer
24 views

Show Title/Date/Excerpt of first post & only Title for rest in Query [duplicate]

I need to show 7 posts of a certain category. The first needs to appear as Title / Date / Excerpt. While the others can just be Titles of the posts. Right now I am having trouble with getting the ...
1
vote
1answer
31 views

How would I format a query that depends on post parent taxonomy

I'm trying to do a custom query which is outside the scope of a single WP_Query, I think I should be using $wpdb but my SQL is a bit ropey. Also I only need the post IDs returned not post objects. ...
2
votes
5answers
239 views

Best approach to create Hot and Trending sections

I am going to implement a Hot and Trending section on a website. I have seen such sections on many popular websites but can't really figure out how exactly this works. Although I assumed Hot section ...
0
votes
1answer
37 views

is_404() - where does this get set?

Where does is_404() get set? Looking at the source in query.php: function is_404() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional ...
0
votes
0answers
32 views

What method does this eventually call: do_action_ref_array( 'parse_query', array( &$this ) );

I'm looking at this line of code at the end of public function parse_query in query.php: do_action_ref_array( 'parse_query', array( &$this ) ); Does this simply end up calling the parse_query ...
0
votes
1answer
34 views

Inner join overrides Advanced Custom Fields plugin's get_field [closed]

I have this search that I made with inner join and where clause. I no longer get get_field() values, they all return false. How can I get ACF to work again? It must be something silly that I don't ...
0
votes
1answer
11 views

How to restrict search on a certain page to only return results against custom taxonomies?

On a specific page, I would like the search to be performed only against the terms from two custom taxonomies. Not the content or title. That is, the user is directly searching taxonomy terms. What ...
0
votes
1answer
436 views

All blog posts are not showing up

This post may already exists but I just missed it in how I searched for it. Here goes. I have recently changed my blog back to the Genesis Framework. I am using the Nameless child theme. These are my ...
0
votes
1answer
540 views

Group posts by meta_key

I have a Problem with grouping meta_values. The Query looks for posts with the meta key "company". I want a unique listing of the colors like: blue red yellow array_unique was not successful and also ...
0
votes
1answer
376 views

Custom loop of a single category, cannot order by date. What am I missing?

I'm going nuts. All I have is a simple loop on the home page of the site (which is a static page), and it should show the most recent (1) post of a certain category. The trouble is no matter what i ...
0
votes
0answers
11 views

Single query using Tags(Priority) and Category(Backfill)

I'm working on a widget that I would like to be populated by (a) the same category as the current post and (b) any post found to have a specific tag. So The query would return 10 results always, but ...
0
votes
2answers
384 views

Show selected images on top in Media Manager

I've searched numerous StackOverflow and Wordpress Awnsers questions, but I couldn't find any solution that matches my situation or even remotely points me in the right direction. I have a custom ...
0
votes
2answers
486 views

Pagination/infinite scroll with WP_Query and multiple loops

I need that the main page of my site have 3 columns: - The first having the 5 most viewed posts; - The second with the next 5 most viewed posts; - The third with the most recent posts. I don't want ...
0
votes
2answers
21 views

Display Post co-authored in Author Page

I am using co-author plus and I have posts in my site that are done by multiple authors. I would like that when I click on the co-author's author page, I will be able to get the posts that he/she ...
0
votes
1answer
1k views

Action hook “wp_insert_post” works but not for last imported post

I want to run a custom function whenever posts are imported to my custom post type. I am currently running this code - function on_post_import($post){ global $wpdb; $results = ...