"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

1
vote
0answers
62 views

Configuring a meta query with multiple post types that have the same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback. I have two custom post types called "Clients" and "Projects" and they each pull information from one ...
1
vote
0answers
825 views

Query by 2 values of a repeater ACF field

Let's say I have a custom post type called Film, with a repeater field called Showings, with fields start_datetime and discount. I need to make a query for those Films that have at least one showing ...
1
vote
0answers
59 views

2 weeks ago from meta query meta value

This is my meta query within my posts query. 'meta_query' => array( array( 'key' => 'rw_membership_ends', 'value' => ??????? ...
1
vote
0answers
1k views

How to get latest posts from each category in regular order

let's say I have a main query and it displays posts from Movies and Music categories. I want the query to show always 5 latest posts from Movies and 5 latest posts from Music category. When I create a ...
1
vote
0answers
848 views

wp_update_post not working

I have the following code in a single script to be run one time to fix post names which are empty. // WP_Query arguments $args = array ( 'post_type' => 'books', 'name'...
1
vote
0answers
305 views

WP_Query with meta_query dosen't return results

I am trying to get list of posts filtered by fields I added using the advance custom fields plugin. I have more fields that I want to use but it doesn't work as I want it to. Here is what the query ...
1
vote
0answers
609 views

Pagination with custom query, custom search form, single and pages, ajax and no plugins

I've read a lot of posts here about pagination with custom queries and tried the suggested answers (like this one). It seems however that my situation is a little more complex, and in the existing ...
1
vote
0answers
78 views

How to get the post terms from a child taxonomy

I have the following code that gets the slug of the taxonomy "author" from a custom post type "books" and gets the post from another custom post type "authors" that has the same slug. <?php ...
1
vote
0answers
104 views

Query posts and return XML

Here is the short and sweet of what I am hoping to do. I would like to have a way for external websites to query mine using a game title and they would get an XML back that contains the text of the ...
1
vote
0answers
68 views

Automatically Query Parent Taxonomy

I have a custom taxonomy on my site that I query from the sidebar of the currently displayed term. Say I am on the Term X archives, then my custom post type of Products with the term of Term X are ...
1
vote
0answers
113 views

Possible to filter custom post type with multiple meta data?

I'm wondering if it's possible in one loop to accomplish what I need to do. What I would like is to sort all custom post types by the meta data of county and put them in order which it is doing here. ...
1
vote
0answers
111 views

Stale $GLOBALS['post'] after custom WP_Query empty result set bothers my template, whose fault is this?

Story below looks to me like it's about a commercial Event Management plugin whose authors to me just don't seem very good at WordPress. But bear with me and let's see if there's also an issue in WP. ...
1
vote
0answers
92 views

database query with more than a couple meta hangs and doesn't complete

I have a development website with about 70 checkboxes for custom fields. The idea is the user selects one or more checkboxes, it queries the database for all posts that have a meta_key for the ...
1
vote
0answers
1k views

Custom WP_Query for WordPress Search Results with meta_query

I am using a custom query to generate my search results. The code I am using works perfectly without the meta_query variables in my arguments array. I am trying to compare multiple custom fields with ...
1
vote
0answers
81 views

How to output topics and replies in bbpress as table?

I need to output the bbpress topic and reply loop in a table format. I'm having trouble finding how one might do this Are there any suggestions on how one might do this? Can this be done using ...
1
vote
0answers
101 views

Meta Query And/Or

My question is very similar to Meta Query with AND & OR? . This question was answered in 2011 by @Otto. With the exception that my logic is different. I want to query, for example, posts with ...
1
vote
0answers
93 views

Query custom post types and a specific page?

I'm using this query WP_Query('post_type=product&posts_per_page=8') I need to include a specific page into the query but not sure how to add it since I'm only specifying the custom post type? Is ...
1
vote
0answers
139 views

Custom post query by taxonomy

I am using WordPress 3.5. My query is, $args = array( 'post_type' => array('product', 'comic', 'magazine'), 'taxonomy' => 'Genres', 'term' => 'hot', 'posts_per_page' => ...
1
vote
0answers
944 views

Multiple keyword search

I have a custom search where I want to enter a keyword or phrase into the search box, and then by pressing enter it adds it to a 'search storage' (already coded, see below). Asume I have 3 posts, one ...
1
vote
0answers
107 views

How to increase load time of an archive/search page (WP_Query)

I'm currently looking at why the archive and search pages take so long to use, and have found that the bulk of processing time is spent on the query_posts that is called before the template has even ...
1
vote
0answers
399 views

How to filter a query by multiple meta keys and order by other meta keys

I'm trying to query posts using WP_Query and meta_query parameters: $args = array( 'post_type' => 'produkty', 'meta_query' => array( 'relation' => 'AND', array( ...
1
vote
0answers
70 views

Display posts with comments closed, with pagination?

i'm using a custom query, which needs to display all posts with closed comments. I have this <?php $the_query = new WP_Query('showposts=-1'); ?> <?php while ($the_query -> have_posts()) :...
1
vote
0answers
79 views

can these 3 queries be re-written as 1 query?

I am creating a Dentist directory site, and I have a taxonomy archive page which requires particular grouping and sorting (see below). So far I have only been able to achieve this using 3 WP_Querys ...
1
vote
0answers
99 views

WP_Query Attachment adds additional attachment count and need to link attachment to post url

I just wonder why WP_Query adding one more additional attachment with the defined number or posts. Also need to link attachment (thumbnail) to the post url. Here is my code <?php $query = new ...
1
vote
0answers
619 views

Does the WP_Query 'private' argument for post status only apply to privately published content?

The only peice of code that I can find that applies to this is on line 2430 in query.php in WP 3.4.1 foreach ( get_post_stati() as $status ) { if ( in_array( $status, $q_status ) ) { if ( '...
1
vote
0answers
233 views

Query most popular terms by taxonomy over 2 week period

I have written SQL for a query that pulls the most used taxonomy terms for selected taxonomies that are published, do not have a parent post are not in a comma separated list over the past two weeks --...
1
vote
0answers
832 views

How to use Meta Value Compare in WP_Query For Max and Min numbers

I am using WP_Query for visitor to filter the posts. The posts is about products. So in the filter, it has a field where user can select Maximum price and Minimum price. (Just like most of the ...
1
vote
0answers
118 views

Posts published last 10 minutes

i have a "featured" section on home page. i want to hide this section after 10 minutes of post publish time. here is the code, i am using. problem is that it hide the "featured" section after 12 ...
1
vote
0answers
323 views

List authors with the last post title and order by last post date

I want to list authors with last post data and order them by last post date. Now i have this codes but i don`t know how to edit them. // Selects from tables wp_users and wp_posts, selecting published ...
1
vote
0answers
2k views

Filter wordpress post categories with jquery/ajax and pagination?

Currently I have a website working with Wordpress and Jquery Quicksand (http://razorjack.net/quicksand/). However I don't want to show all posts at the same time. I wish to show e.g. 6 posts and then ...
1
vote
0answers
457 views

How to order posts by meta_value and title

How do you order products in WooCommerce so that products are random, but at the same time featured products show first? Here is my code: $args = array( 'post_type' => 'product', '...
0
votes
0answers
8 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
0answers
23 views

When will they make it possible to exclude post types from an wp_query?

Very simple, when I am setting up the arguments for an wp query, I can't exclude post types. While it is possible to include them, I would love to see an excluding possibility. Is there any ...
0
votes
0answers
20 views

best method for checking record existence before insert

Lets say there is a custom table which is going to be huge. and there should not be a duplicate record in it. the best soloution that I'm thinking of is: $result = $wpdb->get_var( "SELECT id FROM ...
0
votes
0answers
22 views

How to use get_posts on a secondary loop

I feel like I am missing something terribly obvious. I have set up my secondary loop and it returns the_title() and the_post_thumbnail() as expected, but I am also using the Advanced Custom Fields ...
0
votes
0answers
31 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 ...
0
votes
0answers
28 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
0answers
27 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 ...
0
votes
0answers
37 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
39 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
24 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
0answers
33 views

WP Query with sticky posts and tax_query

I have this query; $posts = new WP_Query(array( 'post_type' => 'post', 'posts_per_page' => 5, )); Which correctly places sticky posts at the beginning. However,...
0
votes
0answers
14 views

Display posts in a custom taxonomy, grouped by a different taxonomy

The setup: I have a custom post type called products. I have a custom taxonomy called styles with terms modern, classic, rustic. I have another taxonomy called seasons with terms fall, winter, ...
0
votes
0answers
15 views

Pick date, month or year from publish date to set up Query

I run the query with order by date. it shows something like this. 2016-5-30 : hello world 2016-5-10 : hell world 2016-4-30 : Title A 2016-4-15 : Title B I want to add one option. Can I pick the ...
0
votes
0answers
20 views

Filter with 'OR' relationship between child categories, and 'AND' relationship between parent categories?

I have a some categories set up like so: Age Child Teen Adult Language English Spanish French Relevant code below: $cat = (isset($_GET['cat'])) ? $_GET['cat'] : 0; $args = array( ...
0
votes
0answers
24 views

Can't get get_delete_post_link to work correctly

I am using WP_Query to to list all of a certain CPT for each user. Everything is being displayed correctly, but for some reason get_delete_post_link isn't returning anything. Does anyone see what ...
0
votes
0answers
31 views

Best way to Order Post in Home without a plugin

We are trying to reorder one section of the home page. our approach was with meta_keys and meta_values WP_Query Sample: <ul id="featuredMain" class="feautrued-main"> <!-- Main ...
0
votes
0answers
11 views

Query by attachment image size

Is it possible to use WP_Query to get attachment images by pixel size? For example all images with a width of 500px and height of 300px. Or images with a height bigger than 300px. As far as i can ...
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 ...