"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

3
votes
3answers
89 views

post__in for get_posts with a dynamic array

I am creating an RSS feed. I have created a table in my database with 400 post id's. I have the rss feed coded I am now trying to link the two so my RSS feed runs only for the list of 400 posts from ...
0
votes
1answer
30 views

How to provide meta_key array to wp_query?

I'm trying to build a wp_query, so far I've managed to get desired result using following query. $args = array( 'meta_query' => array( 'relation' => 'OR', array( //check if ...
0
votes
0answers
25 views

Pagination in html table is not working

I have a custom page template and I found a a PHP snippet that create a pagination in html table. But the code is not working properly. UPDATE: I change the code. But still the code is not working ...
0
votes
0answers
22 views

tax_query not working for taxonomy slug

i have one custom post type 'game' and one custom taxonomy 'console', which is shared by 'game' and 'post'. Now I created a new PHP 'taxonomy-console' and I want to separately display posts from ...
0
votes
0answers
14 views

Retrieving category pages from subcategory returns empty sets

I've a category overview page. It shows its subcategories. These subcategories have subsubcategories which are pages too. I'd like to retrieve those (title, permalink and excerpt) but so far my ...
0
votes
1answer
28 views

WP_Query with multiple orderby NOT working with ASC and DESC, what's wrong?

I have a query with multiple orderby params in a custom page that I am having difficulty getting to work. The query is to return posts with either tag-AAA or tag-BBB tags. And I'd like to sort it ...
0
votes
1answer
19 views

Get posts of an specific term of a custom taxonomy

I'm new at Wordpress development and I was wondering (and trying to solve this) for a long time, so maybe you can help me. My WP use a custom post type named Products. And there is a custom taxonomy ...
1
vote
1answer
21 views

Return Taxonomy/Term Information with Posts (WP_Query/get_posts)

Is it possible to return taxonomy/term information for posts along with the posts themselves when querying with get_posts? I have around 150 items I am querying so I don't want to loop and pull each ...
1
vote
1answer
28 views

Order by meta_value in WP_Query

My orderby meta_value is not working, so I decided to make my meta_value descending from 5 to 1 instead. I'm sorting out a star rating based on the number of stars. If I set 'meta_value' => '5' ...
0
votes
0answers
24 views

Is there a global page/post/product/anything ID?

I am working on compression plugin and need to save compressed styles in to a file. Compression process is done but I need a unique page ID for any WP page in order to save and name the compressed ...
4
votes
1answer
38 views

Include post id[s] into WP_Query()

I'm assigning some posts to some users whom are not the author of those posts. Typically private posts are visible only to the post authors. So, if the author has 3 posts, on his logged in edit.php ...
1
vote
1answer
22 views

Can't get order_by meta_value_num to work properly

This query is working ALMOST as intended, but for some reason I can't get it to order by the custom field opl_submission_tempo. That field is set up to be a number, so I'm not sure where I went wrong ...
-3
votes
0answers
10 views

infowindow display incorrect information, how i can correct it? [on hold]

/style.css"> <div id="map"></div> <script> function initMap() { var myLatLng = {lat:47.047485 , lng:28.863210}; var mapDiv = document.getElementById('map'); ...
0
votes
1answer
13 views

WP_Query returns empty if meta_query has more than 7 values

I have a custom loop to display a custom post type 'properties' . The idea is to search properties based on different search parameters selected by users. Now the weird problem I am facing is that if ...
0
votes
0answers
18 views

Combined filters

I have a problem and i'm really stuck on this one. I have a small 'woodshop' and i want people to filter the results. The case: When i check multiple brands, the types should be updated. But when i ...
0
votes
0answers
11 views

How to search based on meta keys

I am trying to search custom post type based on meta keys but have no success so far I only have one post in this custom post type but no success. Here is the code. $args = [ 'post_type' => ...
0
votes
1answer
16 views

Show one item per category of a custom post type

I'm having a custom type called portfolio with different categories. I want to display all my categories except one. I only want to show one item per category on my page. I'm been busting my butt on ...
0
votes
0answers
17 views

Display Posts in Admin Page

I create a admin page. Now I need to display posts in that page. Should I use WP_Query or get_posts()? (Pagination should be there) Note : I have read When should you use WP_Query vs query_posts() ...
-1
votes
0answers
25 views

WP Query ACF Custom field

So I created a post type named 'client' and I used ACF to create a custom field 'logo' . Initially it will load 8 clients then there will be a 'see more' button which will load another 8 clients. I ...
0
votes
2answers
23 views

Custom MySQL query to pull out Advanced Custom Fields?

I'm trying to modify the My Wish List plugin so that I can retrieve some custom fields (I'm using the Advanced Custom Fields plugin to create my custom fields in the admin end). The plugin uses the ...
0
votes
0answers
16 views

Query Posts by post_meta using WP_Query (data saved as array with keys)

I am working on some project where i need to create class (like karate etc...). My question is, how can i work with WP_Query to Query all the posts by post_meta where the key "day" is "1" for ...
0
votes
1answer
32 views

Content not displaying on paginated page

So, it's taken me most of the day to get my query working (some days I feel like I don't know WP at all) and then I was getting a 404 error on paginated pages which I've since fixed but now I'm going ...
0
votes
0answers
9 views

Use tax_query to sort posts by most “categories in common”

I know I can use tax_query but what I really want is to sort them by "most categories found that are equal" Is there a way to do it easily?
1
vote
1answer
23 views

Orderby the sum of several numeric custom meta fields

I would like to know how I can do the following in the simplest way. Say I have several numerical meta fields (more than two). I want to be able to orderby the sum of those meta fields. But it is ...
3
votes
1answer
40 views

WP_Query orderby one custom field then another in one query

I hope I can explain it properly so here we go! I have a property listing page that should be ordered by the date a listing was posted (data comes form an API so it's not the WP post date) and then ...
4
votes
1answer
30 views

Executing Queries in tag.php

I'm probably being dense, but I can't seem to figure out what the issue here is. The site I'm developing uses a custom loop, with a query that excludes any posts ticked as archived. The reason I ...
0
votes
0answers
23 views

Cast woocommerce events date meta_value with wrong format in WP_Query

I'm using woocommerce events plugin to sale tickets in a client site. The client wants to display the next 3 events after today in the home page. I have created this code: $args = array( ...
0
votes
0answers
21 views

wp query doesn't return html tags

In file I have the following (only part is showed below): <?php $args = array( 'name' => 'contact-us', 'post_type' => 'page' ); $q = new WP_Query($args); ...
0
votes
0answers
20 views

Why a WP_Query instance using 'tag' doesn't work?

everybody. I'm developing a small plugin and I need to fetch some posts with a very simple query: $args = array( 'tag' => $tag ); $fc_query = new WP_Query( $args ); The point here is ...
0
votes
1answer
22 views

Can't get data from audio media

I am trying the get the data of an audio, I've uploaded to a Wordpress site I'm working on (Not my own). I'm quite new to WordPress, but as far as I know, media files such as images and audio is ...
0
votes
1answer
14 views

orderby in WP_QUERY - Use the order from the Dashboard

I'm using the Anything Order Plugin to order custom post types in my dashboard. For a wp_query, I'd like the output to order the posts in the same order as I have them in the dashboard. What would ...
1
vote
0answers
13 views

Select menu should display categories and the item's depth

I have a select menu of a custom post type in the header.php: <?php $selectloop = new WP_Query( array( 'post_type' => 'products', 'posts_per_page' => -1 ) ); echo ...
5
votes
3answers
49 views

Random sort within an already sorted query

I have a working query which returns a set of custom posts which are ordered by their package ID (ASC). For a query with 9 results this may return for example: 4 posts (Post ID's 1,2,3,4) with ...
0
votes
0answers
21 views

Search result by taxonomy name

Currently my search filters by title and I'm trying to filtered by taxonomy tags. How do you I do that. Here is my code: $query = " SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_status = ...
0
votes
0answers
44 views

Add post order to function

How to add post order to this function? I would like to display most recent post from newest to oldest: <?php //Establish first post check variable $first_post = true; ...
1
vote
2answers
31 views

how to merge a WPQuery array with a PHP array and use the Loop to Output the result

I have a mostly normal WPQuery (getting 3 post types) for use on a Blog page. This works great. Client wants Instagram images to be included and ordered by date. I have all the instagram code setup ...
0
votes
1answer
19 views

Query pulling all taxonomies, not one I am specifying

I am trying to grab one random post from a custom Post Type I have that has a taxonomy that I give to it. For some reason it is pulling any post, no matter the category. Here is my Post Type if ...
1
vote
1answer
20 views

Search pages that are a child of the current page

I'm developing my own Wordpress theme and I was wondering if it is possible to modify the search query in a way that it only return results that are child pages of the actual page. The reason I want ...
0
votes
0answers
12 views

using session var to filter author media gallery

I got a problem to solve and would like to know if I'm looking the right way to solve this. I have a site where multiple authors can upload images and they all have a profile page (author.php) where ...
0
votes
0answers
20 views

Orderby one meta key, remove posts with another

I am trying to order custom posts with a custom taxonomy with a meta key value. I am also trying to remove posts from that loop if they are past the date set by another meta key. Here's my code: ...
1
vote
1answer
46 views

new WP_Query to get max price meta value not working

So, I'm trying to get the maximum price of all 'properties' (custom post type). $max_price_query = new WP_query(array( 'posts_per_page' => -1, 'post_status' => 'publish', ...
0
votes
0answers
38 views

Query breaking with 'posts_per_page' => -1

I'm trying to return all posts for a category associated with a custom post type. I have the following query: $cat_name = single_cat_title('', FALSE); $termObj = get_term_by('name', $cat_name, ...
0
votes
0answers
15 views

Tax Query not generating correct query [duplicate]

I have the following query setup to pull videos from a custom post type by category: $cat_name = single_cat_title('', FALSE); $videos = new WP_Query(array( 'post_type' => 'video', ...
1
vote
1answer
14 views

Attachment changing page's permalink - $post not resetting?

I have a function that I use to populate from checkboxes on a page's edit view (post.php?action=edit). I call this function when I render a metabox on the editor page. function ...
0
votes
3answers
69 views

Can't figure out query logic

Help me figure out how to structure this meta_query within my post query! There are two taxonomies attached to my post type ('audition_type', and 'union_requirement'). On a page of my site the user ...
-1
votes
0answers
15 views

Two different meta and its different meta value compare with current and till next seven day Query

I want my posts display with current date or upcoming seven days date of birth or current date or upcoming seven days date of death. My current date work with following code and my date formate is ...
0
votes
0answers
16 views

WordPress loop by three meta values with random order

We have three custom fields with names plan_name1,plan_name2 and plan_name3. Need to check if these meta keys has values (1,2,3) OR (2,3,1) OR (1,3,2) OR (2,1,3) OR (3,2,1) OR (3,1,2) We mean ...
0
votes
0answers
30 views

Is it possible to search for a string in posts OR postmeta?

If I have a text string $search_string and construct a query like this: $args = array( 's' => $searchstring; 'meta_query' = array( array( 'key' => 'my_key', 'value' ...
0
votes
0answers
16 views

WP_Query only displaying one post with custom_taxononomy

I’m attempting to show all posts attributed to the taxonomy item "people", though my query is only displaying one post with the following code. Any suggestions much appreciated! <?php // query ...
-2
votes
1answer
21 views

Best Way to Inventory the Media Library of a 200+ Multisite Installation?

I have a multisite installation of WordPress with 200+ sites. I recently was tasked to do an inventory of each site's media library and was wondering if this could be accomplished programmatically ...