"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
358 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
136 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
11 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
12 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
382 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
23 views

Woocommerce sort by rating

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
357 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
11 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
740 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
609 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
16 views

How to make an insert in wp_posts and use the data inside of WordPress?

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
369 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
261 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
9 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
362 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
14 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
23 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
30 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
234 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
35 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
29 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
33 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
423 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
528 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
10 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
475 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 = ...
0
votes
0answers
7 views

I want to show a list of all the custom taxonomies, and under each a list of some posts that match that

Does anyone know how they might do that? I imagine it would involve getting the list taxonomies, and then iterating through them with php to, and for each taxonomy item, querying the posts and ...
0
votes
0answers
8 views

Category page that displays 3 posts from each subcategory

Alright, so my main menu I am adding category "MainCat" that has subcategories i.e "SubCatOne" "SubCatTwo" etc.. When I click on that page I see all posts from all categories on it, unorganised (below ...
0
votes
1answer
24 views

WP_query issue with no posts

I am using form for my archive page so user can specify which posts they want to see and how they want to see them. I have it setup so they can choose ascending or descending order, posts per page ...
0
votes
0answers
25 views

How to display 20 posts by categories in custom sorted order and by post tile

I need to display 20 posts by categories that have custom sort order and orderby post title. Category (VW) order 1 - Beetle - Golf - Jetta - Toureg Category (Honda) Order 2 - Civic - Odyssey - Pilot ...
0
votes
1answer
15 views

WP_Query secondary query failing

I'm needing a couple queries on front-page.php and am at a loss why this is not working. My first query works fine, however, my second one specifying the category (or even nothing at all) never ...
0
votes
2answers
29 views

Get Posts that are in the current month or later

I have a custom post type that is an Event. I'm trying to query those Events and only return Events that are in the current month or later. So the event could be in the past, but it has to be in the ...
0
votes
0answers
11 views

Events calendar custom order issue

I've been trying to figure this out for several hours now and I just can't find a solution, so, I am new to WP. We are using the Events Calendar plugin, and in the calendar view they want to be able ...
0
votes
0answers
6 views

How to use custom_query_var along with post_id for comments

I have introduced a custom_query_variable - brand in my permalink using the below function. function add_query_vars_filter( $vars ){ $vars[] = "brand"; return $vars; } add_filter( 'query_vars', ...
0
votes
1answer
21 views

BuddyPress activity on edit post for a CPT

I have a Custom Post Type classified I figured out how to record an activity in the BuddyPress activity stream whenever a new post of type classified is created. What I am specifically looking to do ...
0
votes
1answer
20 views

Why does get_posts only show results for Admins or logged-out users?

I use a get_posts() call with these arguments: array(6) { ["include"]=> string(14) "1633,1634,1635" ["post_status"]=> string(3) "any" ["post_type"]=> string(10) "attachment" ...
0
votes
1answer
24 views

Can't seem to filter wp_query by current category ID

I'm querying a custom post type ("donor") and would like to list them grouped by category (a custom taxonomy for this post type), with the category title then all posts for that category. After much ...
0
votes
0answers
27 views

Wordpress ajax load more returns duplicated posts

I'm trying to load more posts from my custom post type via ajax call, it sounds like i'm doing everything alright but one thing which is causing the duplication issue. My load more button does work ...
2
votes
2answers
651 views

Pagination problem after WP_Query with tag filtering

I have a problem with a custom WP_Query. I want a page with all posts with a specific tag. This is the code I'm using: <?php //save old query $temp = $wp_query; //clear $wp_query; $wp_query= ...
0
votes
1answer
26 views

why custom post archive gives always no more than 10 posts despite of paging settings?

I've got a strange problem. I'm programming a custom post archive page. I'm using wp conventions, so I've got a 'project' custom post type and an archive-project.php page, which is correctly showing ...
2
votes
1answer
460 views

Display recent posts from the same category as current post in sidebar

I'm using a modified version of Twenty Twelve and I'm trying to display recent posts from the same category as the current post (except the current post) in the sidebar. I started this way but ...