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

wp query error while paging the posts

i am new to wordpress and i am learning paging the posts but the code below isnt working and i cant find whats wrong. please help. the code: <?php $temp = $wp_query; $wp_query= null; $paged = ( ...
0
votes
2answers
668 views

Custom search: Search posts but display parent page in results

I'm using Wordpress 3.5.1 with a modified twentytwelve theme. My main site structure is based on the Smooth Slider plugin (jQuery Cycle). I have Pages that contain only a shortcode (for example, ...
1
vote
1answer
24 views

Query with custom taxonomy not working

I have custom post type 'mix'. And custom taxonomy 'meal'. And categories in custom taxonomy (one of that is with slug: breakfast) I have problems with making query. My code is : $args ...
0
votes
1answer
492 views

Can I make a search query which includes a space?

I want to search via WP_Query for the test "hello " including the last trailing space. Is this possible and if so, how do I do this?
0
votes
1answer
465 views

Creating a navigation menu of all posts of a custom post type and their children posts?

I have a drop down menu that displays a link (the permalink) to all of the posts of a custom post type (county) and would simply like to display their children too this is the code I have so far but ...
0
votes
2answers
1k views

WP_Query within function within WP_Query

I have a query which looks like this: $args = arguments for the query $query = new WP_Query($args); while ($query->have_posts()): $query->the_post(); $post_id = get_the_ID(); echo ...
0
votes
1answer
1k 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
34 views

Custom post WP_Query infinite loop error

I am trying to build wp_query loop with custom post type and it seems I get the infinite loop as the result. Here is my code that I am using: $apartargs = array ( 'post_type' => 'apartmani', ...
0
votes
1answer
970 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: ...
0
votes
0answers
12 views

meta_query in $args ignored when called from theme

I have the below function in my plugin in the MyManager class. public static function test() { $numRowLimit = 6; $arrArgs = array( 'posts_per_page' => $numRowLimit, ...
0
votes
1answer
14 views

Listing posts with wp-cli

I use wp-cli to export some posts from my WordPress database. I'm trying to understand the differences in behavior that are exposed in the example below: $ wp post list --path=/var/www/home-web ...
-3
votes
0answers
19 views

Category Name in WP_Qurey

When I run this query the categories name the same , all item with categories name "News", I can not define the issue . You can find the code in this link
0
votes
1answer
2k 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
1answer
3k 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
2answers
106 views

How to overwrite orderby with add_query_var

So I would like to have an archive that displays its posts in a random order. <?php $query = new WP_Query($query_string."&orderby=rand"); ?> But also then if the user chooses they ...
18
votes
9answers
23k 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 ...
0
votes
1answer
625 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 ...
1
vote
3answers
521 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
1answer
2k views

How to query posts by meta keys AND under specific category?

The scenary: I'm working in a review system for WordPress, a game review website. It uses default posts, that when under "review" category, shows the review's meta fields (from ACF plugin). It's ...
-1
votes
0answers
55 views

Query between dates using ACF Date Picker fields

$query_args = array ( 'post_type' => taxonomy, 'post_status' => "publish", "order" => "ASC", "meta_query" => array( "relation" => "OR", array( ...
0
votes
3answers
541 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
2answers
23 views

Problem with infinite scroll on multisite with custom query

I have a WordPress Multisite that uses a special query that combines all the posts on the network and uses the main site to display all posts in the network. Anyway, I would like to have my site use ...
0
votes
1answer
31 views

Show more than one post on the main page excluding certain category

I'm currently running WordPress 4.5 with a WooTheme called The Morning After. I decided to change a few things here and there, but encountered some issues regarding the posts_per_page argument used in ...
1
vote
1answer
106 views

WP_Query times out

I have a form with 20 inputs that runs WP_Query and recieves results via ajax. For some reason: query gets considerably slower when 5+ inputs are filled It takes like 10 - 15s with 7 input values ...
0
votes
1answer
632 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' => ...
1
vote
1answer
542 views

WP_Query not retrieving by random order under parent

I currently have TWO subpages under parent page ID 43. Client testimonials.. Anyway. I have the random order thing in the query $args but the order never changes. What could I be missing? ...
0
votes
2answers
22 views

WP Query and date format

I've been using a CPT named "session" that has some date fields. Those date fields are stored via the CMB2 plugin with something like this : $cmb->add_field( array( 'name' => __('Begin :', ...
0
votes
2answers
2k views

Unable to combine “search value” and “tax_query” using WP_Query

This is my function in my template's functions.php. The problem is that this is working: function ajax_search_action_do(){ global $wp_query; $search = $_POST['search_value']; $country ...
4
votes
2answers
4k views

Meta query with boolean true/false value

I'm trying to show all rental properties, first by all properties that have not been rented, and then by all properties that are currently rented. There is a custom post type 'rent' with custom post ...
0
votes
1answer
19 views

WP_Query: How do I sort on meta value and use LEFT JOIN?

I use Wordpress 4.5 and I am trying to modify a query to use LEFT JOIN instead of INNER JOIN. But I cannot get 'relation' => 'OR' to work. See the query below. I have read a number of other posts ...
0
votes
1answer
2k 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 ...
0
votes
0answers
35 views

WP_Query (list) posts according to author's custom field

I'm trying to work out or even find a way to list all the posts according to a custom field of the authors. I'm using WP User Frontend Pro and the plugin allows me to create custom fields for the ...
0
votes
2answers
55 views

Conditional posts in WP_query for search

I have a custom post type that im trying to limit results in search. The CPT is a deal/coupon, with a start and end date for each of the deals. What I'm trying to do is only show these posts in ...
2
votes
1answer
862 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
21 views

query post by author gender

I'm using utimate member plugin on my website. for each member (author), I have a field to store the member gender. (Homme / Femme). the data is stored in my database, inside wp_usermeta. meta key ...
1
vote
1answer
16 views

Wordpress add_rewrite_rule() cannot visit lower url levels

I have a post type called "shop" and added query variables and a rewrite rule. // Adds query vars for shop post type function gtp_add_shop_query_vars( $vars ) { $vars[] = 'shop-category'; ...
0
votes
1answer
32 views

wp_query search not taking keywords with together for multiple words

I am using WP_Query to search results but this is not taking multiple words in AND operation. this is my code $searched_string = $_POST['search']; $the_query = new WP_Query( array( ...
2
votes
1answer
309 views

WP_Query pagination not working in admin area

I've created a custom plugin page. On this page, I list posts using wp_query(). It works fine. I want to add pagination, but it doesn't work, even when I'm using the code provided within codex: ...
3
votes
2answers
587 views

How to stop wordpress to make the default query?

My goal is a redirect to a custom template based on some new rewrite rule, but without having wordpress to make unusefull queries. my code: function add_rewrite_rules() { add_rewrite_rule( ...
-2
votes
1answer
63 views

query_vars category_name only display one catgory out of multiple categories

I am working on a plugin which alter the query arguments! Plugin uses $wp_query->query_vars['category_name'] to get the category slugs. Everything works when I am fetching posts from one category. ...
4
votes
2answers
2k views

WP JSON REST API (Ryan McCue) how to query posts with specific meta data with 'AND' relation?

I use Wp_query class to query my posts. 15 posts are in a template fetched on page load and their filtering works fine. Infinity scroll fetches for other posts using JSON restful services. The filter ...
1
vote
1answer
911 views

ACF Relationship Field Search Filtering

I am trying to assign relate posts using the ACF relationship field. It has typeahead search to search by post titles. I would like to add meta_data search to the ACF relationship search. This ...
0
votes
1answer
13 views

Retrieve custom post by a query on one of its custom fields

I've been using custom posts on my website, among them there are : "session" and "lecture". The custom post "lecture" has many custom fields such "title", "duration"... The custom post "session" ...
0
votes
1answer
593 views

Displaying the category name of a custom post type

So I have a custom query, in which I'm displaying some results posts of a custom post type called "staff". This custom post type is linked to a custom taxonomy called "department". I am able to ...
0
votes
2answers
762 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
1answer
16 views

Change posts archive ordering

I need to change the order of my default posts archives so I have added this to my functions.php but it doesn't affect anything... I've looked at various examples and from what I can see it should ...
0
votes
1answer
26 views

Wp_query with 2 meta keys and array of meta values

Hi in my post_type=shop i have 2 meta keys and array of values Custom fields Name Values cu_status pending,processing,completed cu_date 12-Jan-2016 , 13-Jan-2016, ...... any ...
1
vote
1answer
545 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 ...
1
vote
1answer
928 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
23 views

Is it possible to retrieve all posts with a certain value for metadata?

Under 4.5, I have posts with meta_key as series and meta_value as 19, 20, etc I am trying to loop through them in a template, and I guess I'm a special kind of dense. Most recently I have tried ...