"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

4
votes
1answer
174 views

Enforcing canonical URLs with multiple custom post types

I'm working on a project with several custom post types, where one of the post types is naturally (but not actually in the WordPress sense) the 'parent' of the others. For example, say I have a ...
3
votes
1answer
357 views

WP_Query ignores post_type in category view

I have following query to select posts by my custom post-type. This works fine while being on the frontpage (the snippet is included in the sidebar). As soon it gets executed on a category page the ...
2
votes
1answer
29 views

Hiding taxonomies with no children WP_Query & tax_query

I have this code which has taken over 7 hours to put together through research but the last hours or so I have hit a brick wall! I require the taxonomy title to be hidden if there are no posts ...
2
votes
1answer
193 views

Refine/Filter WP_Query Posts with jQuery or Ajax

I know this has been asked many many times, but I literally searched for an answer for more than 5 hours without finding anything that drives me in the right direction. What I'm trying to achieve is ...
2
votes
1answer
103 views

Impossible to get Attachments Outside Wordpress?

My page (outside the wordpress install) begins something like this: global $wpdb, $wp_query; define('WP_USE_THEMES', false); include_once 'word/wp-blog-header.php'; $args = array( ...
2
votes
1answer
292 views

Gravity Forms field entries into wp_query loop

I have a simple function that filters the page content when form (ID 18) is submitted. It simply displays the entry of field (ID 13)... add_action("gform_after_submission_18", "set_post_content", 10, ...
2
votes
1answer
95 views

When querying a combination of posts and other meta fields, is there a better solution than directly modifying the WHERE value?

This question is a follow up to a question I recently asked. I've implemented what seemed to be the only solution, and it seems to work (YAY!). I just need to verify that: This is really the only ...
2
votes
1answer
342 views

Excluding a custom taxonomy term breaks wp_get_post_terms

I'm trying to exclude one custom taxonomy from an archive page, and then show the terms of the returned posts. When I run WP_Query to exclude the custom term, it returns the posts correctly, but no ...
2
votes
1answer
114 views

Match two posts in categories

I have blog posts each having three or more categories. The issue is that I need to search related posts and I have to match at least two categories i.e. there must be two common categories. I am ...
1
vote
1answer
34 views

How to sort a custom wordpress query by combination of meta values?

I'm trying to build a custom query that's a combination of custom key values. For example, with the code below I'm able to sort my posts by how much money they've received (paidusd) and how much tips ...
1
vote
1answer
30 views

Shortcode for latest -not expired- posts

I've made a short code (part of a plugin) to display the posts which aren't expired. For saving the expiration date, i made already a meta key called newsbox-date. Handy for micro-news, short ...
1
vote
1answer
149 views

How to reduce the number of queries?

I have meta key "Due" for posts....if a post has expired (past the current date or not equal to it) then it will not be displayed in the count. This is my code, which works perfectly. My only problem ...
1
vote
1answer
49 views

Order posts by 2 custom fields and if one custom field is zero orderby another custom field

I have a really tricky function to implement and couldn't find a way by searching Please see details below I have a custom post type called "accommodation", and for this post type, there are 2 ...
1
vote
1answer
78 views

Replacing raw database query to WP_Query

I have a plugin which displayed the top most voted posts in a list with the vote count. The code is placed here: https://gist.github.com/hchouhan/6727356 function ...
1
vote
1answer
265 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
116 views

Search Custom Post Type with all meta attached?

I'm currently have a search box that's supposed to search a certain post type. It's supposed to check the query against all standard cpt content, tags and the associated meta data. I'm wondering how I ...
1
vote
1answer
223 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
341 views

Query by meta_key and order by meta_value_num return orderby date

I'm trying to use the orderby and custom WP_Query features of wordpress. It works nicely to select item by their meta and to order by date. Unfortunately, it seems that I could not get the post ...
1
vote
1answer
241 views

Can you order posts from wp_query by two custom meta fields?

I'm working on a site that lists events. Right now this query lists events by date: $args = array( 'post_type' => 'espresso_event', 'post_status' => ...
1
vote
1answer
68 views

Query Posts With Over 1000 Views

The code below is from this link. It basically creates a hit counter, but I'm probably gonna have to do this by IP. How do I make a WP_Query, where only posts up to 1000 views can be seen on the ...
1
vote
1answer
51 views

How to combine custom fields to make one order-able value

I have three different custom fields, for day (01-07) hour (01-12) and minute (00-59) and I really need to combine them into one custom value so I can actually order them using wp_query. I cant ...
1
vote
1answer
185 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
73 views

change recent posts based on category

I am writing a code to display the recent posts of different categories. On clicking category 1, I want to display the recent posts from cat1 and on clicking cat 2 the recent posts from cat2 and so ...
1
vote
1answer
773 views

search query within custom taxonomy term, post title and meta field

I want to create a search that does: Search within my custom taxonomy - custom-tags search the post title search select meta field ?? dont know search with custom post type - easy part I looked ...
1
vote
1answer
63 views

How to list posts with disabled/closed comments, with pagination?

i'm interested how to display all posts (from all categories) that have closed/disabled comments? I have tried using the comments_open() function inside the loop, that works, i don't know how to ...
1
vote
1answer
114 views

Query Page Content From Theme Options?

I'm trying to create a slider where you choose what pages are shown in the slider, using a theme options panel based on the https://github.com/vauvarin/options-framework-theme That lists the pages in ...
1
vote
1answer
135 views

posts_per_page option limits the number of Gallery items

I have noticed that if I have a query where posts_per_page are set to 4, any (image) gallery that belongs to one of those posts will too have only 4 items (although when I create the gallery from Add ...
1
vote
1answer
244 views

Query two taxonomies via URL or link?

I've been banging my head about this, and have created a work-around, but it would be much nicer for my site's organisation if I could figure this out. I want to be able to query posts across two ...
0
votes
1answer
17 views

Query posts by a type and another type only if post is in specific category

I have a featured post type and a reviews post type. I would like to include reviews of a certain category (I use categories from the posts type) as well. How could query args be crafted? A crude ...
0
votes
1answer
46 views

Is there something like re-route concept in WordPress?

I'm using Woocommerce with a premium theme, have some product category. I would like to hide one category if the user is not logged in or not in a given role, by hide I mean don't show the products ...
0
votes
1answer
25 views

Query seems to be duplicated

I'm just hit a development brick wall and can't seem to find a solution to this problem. I've running two WP_Query's the aim is one displays premium stockists and the other one displays the none ...
0
votes
1answer
42 views

Next / previous posts link doesn't show up with Posts 2 Posts

I am working on a Wordpress project where I use the Posts 2 Posts plugin to show posts from one post type to posts from another post type. This works great but for some reason my next_posts_link() ...
0
votes
1answer
45 views

Show multiple categories in query using redux framework variable

Stuck on trying call an option variable using the Redux Framework - that is utilizing multi-category select - inside the query. Here's what I have as my query: $the_query = new WP_Query(array( ...
0
votes
0answers
203 views

Wordpress $wpdb->query() inserts multiple rows with duplicate data

I am experiencing very strange problem with wordpress query() function. I have a form on page 1 where below code to insert a new record. if(isset($_POST["transaction_id"])){ global $wpdb; ...
0
votes
0answers
287 views

Create args for WP_Query using infinite scroll

I'm trying to use infinite scroll in my page as below. http://phototravel.flop.jp/category/japan/mothersfarm/ All photos are actually custom posts under a category. It's using jquery masonry layout. ...
0
votes
0answers
126 views

Complex WP_Query Using Post Date And Post Meta

I am using Wordpress as a CMS on a website which has standard posts, a custom advert post type and a custom event post type. The event post type has some custom meta which stores the event start date. ...
0
votes
0answers
105 views

Search with meta_query and tax_query

I'm working on a little database for series based on wordpress. I've implemented a custom post type called "anime", some taxonomies (Genre, a_types..) and a lof of customfields. (based on acf). Now ...
0
votes
0answers
32 views

When importing a database any page with a wp_query in doesn't work

I've noticed this a lot, when I export a database from a test site and import it into a live site, any (or most) page with a wp_query in it doesn't show up correctly (It shows the theme, but as though ...
0
votes
0answers
73 views

Multiple homepage layouts as selected by user from theme options

I am working on a theme which will enable users to select multiple layouts from the theme options panel. What I did so far is to create multiple theme files, depending on each theme, put it in a ...
0
votes
0answers
211 views

Query recent posts by author

I'm fairly new to wordpress but trying to get recent posts by a specific author. The following code displays only most recent bog posts. I am using a custom field to get the author ID. EDIT by ...
0
votes
0answers
69 views

Custom Post Query Combined with Conditional Tags

Is it possible to combine displaying a list of custom post types on a single page depending on conditional tags? Below is what I have so far, basically if there are 4 posts or less show the posts, if ...
0
votes
0answers
66 views

$wp_query empty on my home page

I've got a Multi-user install set up with several sites, each with a few posts. I recently added a new user, made it a super-admin, and then deleted the original super-admin. I transferred all the ...
0
votes
0answers
66 views

Display Category Navigation wp-navi

I am writing here because after hours and hours I can't fix my problem. I am using a Custom Theme I am using the plugin wp-navi My pagination works fine. The problem is to display categories when ...
0
votes
0answers
93 views

Posts 2 Posts, losing connection in template parts

I am using the Post 2 Posts plugin to connect different post types. My code works perfectly when it's all in one file (archive.php). The problem I have is taht I want to split out the part that does ...
0
votes
0answers
132 views

wp_query orderby value not from meta_value

I'm using the myreviewplugin to add ratings to posts. I'm now working on the posts loop and customising the query using wp_query. Everything is working fine, but I need to expand the orderby ...
0
votes
0answers
148 views

Multiple Wp-Query Loops inside index.php

The site url is: http://aachurch.org/reborn I'm trying to achieve multiple wp-query loops inside my index.php, showing different categories of posts. The first loop works but nothing shows up for the ...
0
votes
0answers
240 views

custom Wp_Query / permalink + wp_pagenavi = not working

Testing it in my WAMP environment (with default permalinks), next/previous/page number(s) (links) pulls up the appropriate information - pushing it to live with a custom permalink structure results in ...
0
votes
0answers
61 views

No results for my WP_Query array

I have to get related posts via keywords/tags, and I found a ton of examples elsewhere on how to do it, but the query doesn't seem to produce any results. Can anyone point out how to do this, and is ...
-1
votes
0answers
16 views

Classes and Including Files on Init

Switching my plugin over to a class based system so it can be more easily expanded upon. I previously used global functions to set my rewrite rules, and to call them on init. I keep those in a ...
-1
votes
0answers
15 views

Suggested posts from categories

I need a certain procedure to display suggested/similar posts for each post, but I've never done something like this, so I'd ask for some guidance: Take all the categories the current post belongs ...