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

Can't use orderby in WP_Query

I can't get my posts to order by the date, descading. I've got the following code: $jobs = new WP_Query(array( 'posts_per_page' => 50, 'post_type' => 'job', 'post_status' => ...
0
votes
0answers
361 views

Problem with WordPress 4.0 and $wp_query

On my website I have a logo area that is controlled by a function that determines which page the user is on and loads the specific content depending on the $page_id value. Since WordPress 4.0 there ...
0
votes
0answers
11 views

Pagination on author page

I created a custom query inside author.php, and I would like to add pagination. The problem is that the result is 404 error everytime. $args = array( 'post_type' => 'wpost', 'author' => ...
1
vote
2answers
138 views

WP Query orderby meta key natural sort?

I have this code: $args = array( 'posts_per_page' => -1, 'post_type' => 'product', 'meta_key' => 'custom key', 'orderby' => 'meta_value', 'order' => ...
0
votes
0answers
34 views

Complicated WP_Query

I'd like to query wp posts in custom way, I'm not sure whether or not WP_Query class can do this, but I'd like order the posts by posts that has a specific custom taxonomy and then continue with the ...
0
votes
0answers
36 views

How to show custom post type in page hierarchy?

Is it possible to show a list of pages with a custom post type included in that list if it's parent is a page? So if I was using the query more specifically something like get_pages(), ...
0
votes
1answer
44 views

Query outputting YouTube url rather than embedded video

I am having an issue with a query outputting the YouTube url rather than the video itself. The post I am querying has a Youtube url in the content area. Of course, when viewing the post, you don’t see ...
0
votes
0answers
71 views

Why does order ASC break offset in WP_Query?

I have a function being used in an AJAX call for adding the next 5 posts. The call checks the amount of posts being displayed already and send that as an $offset parameter. The $args for query_posts ...
1
vote
1answer
60 views

Future post ID not showing

I'm attempting to send an email notification when a scheduled post is published. I've tried quite a few different ways. I receive the email but the id (and other random details) are not published with ...
1
vote
2answers
113 views

How to display future posts - modified query still yields 404

I have a very strange problem and I am stuck. I want the single page to display posts with the post_status of publish and future. So I added this code to my functions.php in my theme: function ...
0
votes
0answers
19 views

Is it possible to apply a meta_query to one specific post type in a query with multilple post types?

I have two post types, news and events : A news has no custom fields. An event has two custom fields : start-date and end-date. I want to display news and events on the same page, ideally with ...
0
votes
3answers
58 views

How to get all author posts outside of author templates

Currently, I'm trying to display all posts from an author(e.x admin) in a custom page with name that is completely different than these template file listed here. So inside this page, I'm using WP ...
1
vote
1answer
331 views

Pagination on a WP_query not showing navigation links

I'm having trouble adding pagination to a page. I'm using WP_query and would like to pull back 4 posts per page. The basic query seems to work OK but I must be missing something regarding pagination. ...
-1
votes
1answer
31 views

Query for page content, and query for posts on the same page?

I'm having trouble with trying to make a blog listing page, I have a page in Wordpress called Blog. Within this is some written content and that's it. I'm using the following query to make it output ...
0
votes
1answer
56 views

Custom Post Type meta oembed html output resulting in WSoD

For a homepage template I'm trying to query a custom post type with a couple custom meta boxes. They are a title, oembed text field, and text area. I've compiled the below code from various sources as ...
0
votes
1answer
64 views

new WP_query using custom fields

I am trying to query child posts from two parents (that part is working fine), ... but now I want to exclude posts that have a meta_key of 'feature' with a meta_value of '1' Using the Codex ...
0
votes
0answers
54 views

jQuery Ajax decompose WP_Query

I am working on a Ajax search field where I want to load links to products matching with my search query. My problem is that I don't know how I can get the titles and the permalinks from the query ...
1
vote
1answer
66 views

How to set multiple `orderby` in query argument?

I am trying to fetch pages by multiple ordering. menu_order in descending and title in ascending. Following is the argument: $args = array( 'post_type' => 'page', 'posts_per_page' => 20, ...
0
votes
0answers
43 views

running queries of multiple post types

I am trying to figure out the query I need to build for my project. I've got a little idea but i am getting confused by all the different query methods and I'm not sure which one to use. I have two ...
1
vote
1answer
31 views

WP Query Exclude and Start by Menu Order Offset

I have a set of posts in a custom post type that I have given menu order attributes to. I am hoping to use wp_query to query the first 3 by menu order, then the next 3 by menu order. For example - ...
0
votes
1answer
46 views

How to retrieve the date on which a post was moved to trash?

I need to retrieve a list of posts that are in trash based on the date on which they were trashed. The following code allows me to retrieve posts that are in trash, but how to filter them by date? ...
2
votes
1answer
56 views

WP-Admin edit.php & post.php slowdown after import of 10k users

Situation: Clean wordpress install No plugins VPS server 5.2ghz / 4gb RAM (Default Directadmin) Import of 10k users Problem: WP-Admin edit.php and post.php take >4sec to load. A custom post ...
0
votes
1answer
40 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 ...
0
votes
1answer
72 views

Why does “get_option” pull in the older value in options.php, rather than the newer value, on submission of a form?

I'm building a simple post order "plugin" through my theme's functions.php. The function updates the value of an option in options.php on submission of a form. So, for instance, when "1" is inputted ...
0
votes
2answers
41 views

Having Trouble Running Query From Shortcode Using Tribe's Events Plugin

I am not getting any results back using this code, even though I am passing in correct values. Can someone please take a look? function webinar_list_shortcode($atts) { global $post; // Defaults ...
0
votes
1answer
75 views

Order posts by date and then by custom field

I am trying to do something like this one. Ordering posts by day (not time) AND meta value I want to list blog posts ordered by date (not time) and then within that day, I want to sort them by custom ...
0
votes
2answers
41 views

w3 total cache and post__not_in

I'm using a modified version of the Recent Posts plugin together with WP Total Cache. I'm using post__not_in as I don't want to display the current post again. It works well, but if Object Cache is ...
0
votes
0answers
30 views

Custom post type single display is ommited

I've created a custom post type: tutorials using generatewp.com generator and registered it with register_post_type(). I'm querying the list of tutorials in a custom page template like that: ...
0
votes
1answer
21 views

Change 'post_modify' with a query

I'm trying to change the value of post_modified columns with a query like that: $wpdb->query( "UPDATE `$wpdb->posts` SET `post_modified` = ".$data_modifica_post." WHERE ID = ...
0
votes
0answers
40 views

Year based WP Query

I am am having a strange issue, trying to get year based posts in wp_query, when i do directly, 'year' => '2014' it works fine, but i have the year stored in a variable, $year, then i do 'year' => ...
0
votes
1answer
54 views

WP_Query: Posts within category OR custom post type

I don't like to bother you guys, but this is already driving me nuts. I have a legacy post model within a specific category called 'listas-2' that used shortcodes to show some fancy things. Now I ...
1
vote
1answer
138 views

Ordering by meta_value AND date NOT WORKING with wp_query

I want to select posts and custom post type with a specific meta value (mb_home!=0), of last week and ORDER them by mb_home. If they have the same mb_home value, I want them to be ordered by date. ...
2
votes
1answer
149 views

Meta query with string starting like pattern

I have a custom WP_Query with the following meta_query: $meta_query = array(); $meta_query['relation'] = 'AND'; if(!empty($postcode)) { $meta_query[] = array( 'key' => 'postcode', ...
0
votes
1answer
312 views

WP_Query on custom post type not displaying, multiple loops & get_template_part

I'm having problems getting my testimonials to display. On page.php I have a testimonials section. So I have a loop that grabs the content for page.php, and then a get_template_part('content', ...
0
votes
1answer
36 views

An archive page without post format (just standard post)

I'm trying to get posts with not marked with any type of post types (aside, audio etc). But I didn't find any solution to do this. I thought doing this with custom fields but site has a lot of ...
2
votes
1answer
43 views

Show posts without term

I am working on a product page where I show reviews from my post type 'reviews', if the product page title matches with my term from the taxonomy 'review-product'. Example. Product page title: ...
0
votes
1answer
16 views

Post__not_in only removing first 2 pages

I am using post__not_in to remove pages from a query but it's ignoring anything more than 2 items My code: $selected_check = array(); $checks = new WP_Query( ...
3
votes
1answer
159 views

Combining two wordpress queries with pagination is not working

I am trying to combine two WordPress queries but it's not working as well as pagination. I want to display today's all posts sorted by comment count and after that I want to display all posts ...
0
votes
0answers
32 views

How to get rid of extra Untitled Article in html5 document outline when using new WP_Query?

Here is a simplified version of the code I'm using on a static homepage template made for a child theme of TwentyTwelve. I simplified some of the divs used for styling and just focused on the problem ...
0
votes
1answer
23 views

Display post format post in the sidebar

I am trying to pull posts with the post-format of "quote" on my sidebar. I'm getting the code to spit out the else statement but that's about it so far. I am working in the roots theme if that helps ...
-1
votes
2answers
72 views

Query: offset post list, unless it's a specific category

Here's my code: <?php query_posts(array ('showposts' => '1', 'cat' => '-11')); if (have_posts()) : while (have_posts()) : the_post(); get_template_part( 'content', 'archives' ); ...
2
votes
3answers
115 views

PHP memory friendly alternative to get_posts()

I was running into memory issues with this: get_posts( array( 'posts_per_page' => '-1', 'post_type' => array( 'product', 'product_variation' ) ) (there are thousands of results) just trying to ...
6
votes
2answers
260 views

Is it possible to query all posts that don't have an attachment?

I want to get a list of all posts that don't have an attachment and delete them. This question takes about getting all posts that have an attachment, but I want the reverse of it. The brute force ...
0
votes
0answers
24 views

Returning error with WP Insert without getting an error in error log

I'm checking if a key exists in my database using $wp_db->insert() and am executing code based on the result. I know that if a row already exists it will return false and I want to use that to execute ...
1
vote
2answers
72 views

WP_Query posts_per_page Only Bringing Back one post

I'm trying to modify the Genesis Tab plugin to show more than one post per tab. I've tried in vain for the past hour, but my little PHP knowledge just isn't cutting it unfortunately. Here is the ...
4
votes
1answer
85 views

How to place a loop within another loop?

I have two loops setup using WP_Query: $latest and $popular that I'm working to setup in this example layout: Latest                        ...
0
votes
1answer
107 views

How to show subcategories using loop?

i am using wp_list_categories('child_of=54&title_li=') method to display all the subcategories, but it is showing only one, how can i use it with loop to show all the subcategories properly.
0
votes
0answers
27 views

How to sort post by custom table value

How can I sort my post by the maximum vote in custom table I have table like this:( user_votes) here post id 315 have votted two times so I just want to sort my posts by maximum vote. I am only ...
3
votes
1answer
55 views

Query Custom Meta Value with Increment

I have a Query searching for a meta value I have added to my posts (meta-select). I have it feeding out in a loop with 4 results. Let's say I want this loop to start with the meta value "2" and work ...
0
votes
1answer
109 views

wp-query, pull children of parent page

So here's what I'm trying to do: I'm trying to develop a theme that shows any sub-pages on the parent page. I've gotten this running successfully with a WP_query and a simple loop: <!--show sub ...