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

Persistent Shortcode Attribute Variables using WP_Query and WP AJAX

I'm trying to: list posts using a shortcode using WP_Query have that list use pagination have that pagination use AJAX ...and - where I'm getting stuck - manipulate my list via shortcode attributes ...
-4
votes
0answers
21 views

Creating custom functions with wordpress

Can any one help me out with this: how can I write the functions: Write a custom php function in functions.php for salient-child get_event_member_product_url(post_id). In this function, when a post ...
0
votes
1answer
28 views

Populate tax_query terms parameter with post term

I need to populate the terms parameter in my tax_query with the current term of the post. I have been trying to use the WP function wp_get_post_terms in a variable and then referencing that variable ...
0
votes
2answers
35 views

date_query won't accept day parameter, but will accept month and year for a custom post

I have a frustrating issue. I am using the date_query as referenced in the Codex: <?php $today = getdate(); $args = array( 'post_type' => 'Lighting', 'post_status' => 'publish'...
-1
votes
0answers
25 views

Disable Pagination while limiting the number of Post to be displayed

I want to disable pagination and also limit the number of post to be displayed. I am using two query on same page with different arguments. First one displays all posts while the second one should ...
0
votes
0answers
11 views

WP_Query - Find the State and Match Zip Code

I a trying to develop a search box in which people can type in the State and enter a zip code and in return the results will show specific people. I have added Advanced Custom Fields and each person ...
0
votes
1answer
49 views

Get term by custom term meta and taxonomy

How to get term by custom term meta and taxonomy or how to filter tax_query by term meta instead slug/id? function custom_pre_get_posts($query) { global $wp_query; if ( !is_admin() &&...
0
votes
0answers
28 views

custom taxonomy not working in wp-job-manager

I'm working with the wp-job-manager plugin, and i need to add some custom fields in my search filter. I'm using another plugin for adding custom date fields, and it works perfectly. So i started using ...
0
votes
0answers
17 views

Set query custom parameters

How to set query to get posts by taxonomy, term, and term custom field? Url parameters: /?post_type=product&taxonomy=manufacturer&term_slug=abc&term_external_slug=aBc Set new ...
0
votes
1answer
31 views

Excluding posts with certain value of meta_key keeping posts without that meta_key

There are solutions for this problem, but what I could found, all of them are from long ago. So I am looking for a solution (if there is any) considering recent updates. I have a meta key wpse_city, ...
0
votes
1answer
34 views

WP_Query: Exclude hidden products from WooCommerce product list

I hope this is not too specific to WooCommerce. I have a nifty shortcode that displays a list of all my products with SKUs. However, it also includes products that I have published but have set the ...
0
votes
1answer
16 views

Main site single-property.php design, as homepage of a multisite

I've been researching how to do this for some time now, and I'm coming up short. I have my main blog, example.com, which we've created a custom post type of Property. I'm needing the exact layout and ...
0
votes
1answer
57 views

Order or Orderby in tax_query (How to define order of terms in WP_Query)

I am trying to work out how I can define the order of terms in my WP_QUERY. I am creating a knowledge base. I have a CPT called knowledge-base and a taxonomy called topics. My code outputs all of ...
0
votes
0answers
5 views

Expire posts with Pre and Posts Get new WP_Query in Categories

On my website I use Get Pre Post to display active posts (without an expiration date and those who are yet to expire), and also new WP_Query use to display only posts expired in each category page. ...
0
votes
0answers
15 views

Trying to get property of non-object in: $tag->slug

I suppose this is a very common propblem but. This function I was using was in fact not a problem until a couple days ago , that the debug starts showing this message: PHP Notice: Trying to get ...
0
votes
0answers
49 views

Order ascending is ignored in meta query?

I'm using pre_get_posts to alter my main query and attach a meta query to it. This is on a woocommerce products archive page (...not sure if that would make a difference). function has_upcoming_date(...
0
votes
1answer
29 views

DIsplaying URL of custom field in last post of certain taxonomy && post type

So, I need to echo the URL of a custom field from the last post published in a certain post type and with a particular taxonomy. This code so far works OK, but even that numberposts = 1, $...
-1
votes
0answers
24 views

What is the one-query (or the fastest) way to get posts and their terms (more taxonomies)?

Now this might seem like a similar question One query to get posts and their taxonomy terms but it is just similar and does not have proper answer. Goal: I need to get limited number of posts and ...
0
votes
0answers
22 views

WP Meta Query at depth 2

I'm interested in doing a meta query according to some post data that doesn't exist at the first level of the post meta. In other words, I would need two or more keys to get to the variable I'm ...
0
votes
0answers
41 views

How to select N number of products and display it randomly in Woocommerce

I have a woocommerce setup with about 10,000 products, i would like to display all the latest products on the home page so that i can have N number of latest products from each PRODUC TAG displayed in ...
0
votes
0answers
15 views

How to add OR condition in wordpress main seach box Query?

I'm trying to search from main search text box. Custom post type "course" and it custom taxonomy 'Location'. It I search with "USA", In data it looks for 's'= 'USA' AND 'loaction'='USA'. What I ...
0
votes
1answer
23 views

I want to get title name of post, but i didn't get by this code. Any suggestion?

add_shortcode('sort_featured_restaurant','sort_featured'); function sort_featured(){ $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) { echo '<ul>'; ...
0
votes
1answer
27 views

Query events post type after current date and timezone

So I am making changes to a clients website and currently they have an events post type with some custom fields that allow them to set an events end date/time and the events timezone. The custom ...
0
votes
1answer
30 views

WP_Query Custom Post Type if Category ID Equals

I've setup a custom post type "slides" and I've created two categories for the slides custom post type: "slides-testimonial" (id = 7) and "slides-regular" (id=8). I would like to run a single loop, ...
0
votes
1answer
29 views

Only Get A Certain Number of Posts From WP_Query

I'm not sure what I'm doing wrong. None of my WP_Queries are returning the given number of posts. From what I can tell, it's returning all of them. How do I fix this? Here is the code I'm currently ...
0
votes
1answer
50 views

Exclude current post from an array of posts?

I'm trying to exclude the current post from an array and I know that the codex says that it's not possible to combine post__in and post__not_in in the same query... But in wordpress everything (well, ...
0
votes
0answers
24 views

Wordpress Pagination archive/category [duplicate]

I have a problem with creating a simple pagination for the categories with WP_Query. I've got it to work for the archive, but if I try the same on the category template, then I get redirected to the ...
0
votes
1answer
21 views

Object of class WP_Query could not be converted to int inside shortcode

I have the following code which is used to display download posts by the custom taxonomy. I am receiving the error Object of class WP_Query could not be converted to int When I have Query ...
0
votes
1answer
31 views

Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]

I'm currently facing a little problem. I'm using ACF plugin which generate complex meta_key names when creating hierarchical fields. I found in my database meta_key named modules_1_content_0_module. ...
0
votes
2answers
47 views

display post multiple times based on array of dates

I have a custom post type for a simple schedule list and using the meta box plugin i have two meta boxes assigned to custom post type. 1 for an image and 1 for an array of date times . In my ...
4
votes
1answer
103 views

author.php with ACF and CPTs

As I write this, I'll do my best to avoid an XY Problem. What I'm trying to do: I'm trying to build an author.php template that: displays data from Advanced Custom Fields on the user's Profile ...
1
vote
0answers
33 views

Display most popular in the past two days

Hi I'm using this code below to display the most popular post on my wordpress site. It works great! I was wondering if there was anyway to show the most popular post of the current day? This in my ...
8
votes
4answers
266 views

Is it possible to completely stop WP_Query retrieving posts?

I'm trying to use WP Redis to cache entire $wp_query object with key is $query_vars_hash. This is how $wp_query was added to $wp_object_cache: add_action('wp', function($wp) { if ( is_admin() ) ...
6
votes
1answer
92 views

How to remove_query_arg() for paginate_links()

I implemented a pagination using paginate_links() like below: <?php function wpse229670_pagination( $query = false ) { global $wp_query; $query = $query ? $query : $wp_query; $...
3
votes
1answer
93 views

Using WP Query to search within ALL keys in meta query

What is the best way to create a meta query that searches through ALL meta fields (keys)? What I'm trying to do is something such as: $posts = new WP_Query(array( 'meta_query' => array( ...
0
votes
1answer
53 views

How to fix pagination for custom loops on front-page.php

A search on this topic on this site throws up a lot of results claiming to have resolved this issue, but I am having a contrary experience after implementing these guidelines as outlined here: How ...
0
votes
0answers
32 views

Custom Page Load by wp_query

Is there a way I can use wp_query to retrieve custom pages and posts, and display them on the front page of my WordPress site? I'd like to do that for every custom page I have, to end up with a one-...
0
votes
1answer
32 views

Dividing the loop to style post differently

I'm using a plugin that displays post and shows them in a certain area on my site, such as the sidebar or anywhere i put the <?php;?> code, but only if the author that is writing the post clicks ...
1
vote
1answer
36 views

Custom query, checking values of multiple meta keys

I am using two plugins, and I have some issues combining them. One is an event calendar, which add new meta keys to posts, the other is a show-posts-as-grid plugin, that fetches the event posts from ...
0
votes
0answers
35 views

How to format a WP_Query using groupby and orderby meta value

I have a messenger in my app that uses a custom post type to store messages. I have two ways of showing these messages in the front end of the app: conversations and messages. Every message gets 2 ...
1
vote
0answers
54 views

Custom Pagination in Shortcode with WP_Query

Trying to add custom pagination within a visual composer shortcode. The get_next_posts_link() and get_previous_posts_link() functions are working fine, but when I try to add the pagination function, ...
0
votes
1answer
28 views

find posts that don't have a custom taxonomy

I am using a custom taxonomy series to keep track of posts that are in a series. I would like to find the posts that do not have a series. I have the following query: global $wpdb; $pr = $wpdb->...
0
votes
0answers
39 views

Sort custom post type by a custom field from another custom post type

I have a custom post type called "listings". When adding/editing the listing, the user can choose enter the ID of a "Plan". I also have a custom post type called "plans" which contains some fields ...
0
votes
0answers
13 views

how to solve pagination error in category.php file [duplicate]

Now i have four category in my site. i can get all the pages of one category which is tour category and if i click other three i can see first page but if i click to second page it gives page not ...
0
votes
0answers
65 views

How do i get category name dynamically?

I have a page category.php. but i have more category for pages then i want display all the related category pages in category.php page. how can i change category_name dynamically when user click ...
0
votes
0answers
26 views

Using custom query on a custom page for a custom post type

I have setup a custom page (page-mypage.php) and I want to list all posts of a custom post type when I use the loop in my custom page. I'm using pre_get_posts hook to modify the query. Problem: In ...
0
votes
1answer
30 views

Query only displays one page_id

I have a short query that is supposed to load IDs from pages that the user picks in the backend. Currently it does display an array with IDs on the frontpage, but it stops displaying posts after the ...
0
votes
1answer
30 views

Filter by title content and meta key at the same time

Using: $query = new WP_Query(); How do I filter to get records with titles OR content OR meta keys which contain a part of a string. I currently have $args=array( 'order'=>'asc', ...
3
votes
1answer
51 views

Order terms inside a select dropdown

I'm working on a project where I've a dropdown of all the terms inside a taxonomy. If the user selects a term, then a function is executed. Eveything is working great, but I can't get that dropdown ...
1
vote
1answer
29 views

Adding an array from a query string to a WP meta_query

I am collecting values from a query string as an array. Then collecting those values and placing them into the value of the 'meta_query'. I am having trouble where nothing gets outputted from the ...