"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
2k 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 ...
1
vote
1answer
530 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 ...
0
votes
1answer
31 views

Using Cookie Data For WP_Query Loop

I'm trying to retrieve data set in a cookie and use this to run a query. I've set the cookie in functions.php like so; add_action( 'init', 'resultsCookie' ); function resultsCookie() { ...
0
votes
0answers
21 views

Saving Query Data & Using On Subsequent Pages

I have a PHP form that uses GET to send vars to a URL and return specific products in WooCommerce. Within the loop, I already have a piece of code to collect each product ID result. What I now need ...
0
votes
1answer
33 views

Filter user list that meta_value is empty

I am trying to get all users that meta value is empty so i tried many variations and cant get the list of all user that birthday field is empty (not set). ...
1
vote
5answers
613 views

Pagination for blog posts reloading same page

Symptoms Visiting /blog/ loads the first 10 posts, as expected. Visiting /blog/page/2/ (and onward) loads the new URL but with the same 10 posts. Nothing changes but the URL. Setup Details Custom ...
0
votes
2answers
520 views

How to query for posts (in hierarchical custom post type) that have children?

I'm trying to figure out how to query for posts in my hierarchical custom post type, presumably using WP_Query that have child posts. I can get all pages that don't have children by setting ...
0
votes
1answer
845 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
51 views

Sort users by “birthday” using WP_User_Query

I have created user meta that holds user birthday (birthday). birthday is date field. Now i am trying to figure how to sort (get) all users that have birthday based on specific month. I have ...
1
vote
1answer
491 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? ...
16
votes
9answers
16k 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
0answers
42 views

Ultimate Wordpress Query Search Filter plugin Results page id?

So, I am a Wordpress Novice(not even a Beginner) and I just started using Wordpress around two days ago.It seems I am already stuck on a problem. I am using a plugin called Ultimate Wordpress Query ...
1
vote
1answer
39 views

How to connect two custom post types with nested loops

I have 2 custom post types created: "classes" and "teachers". I have created using Advanced Custom Fields plugin a field for "classes" custom post type, a multiselect that helps me add certain ...
-1
votes
1answer
64 views

Related posts with WP_Query

I'm stuck with the related posts querying. I need the related posts to be displayed with any depth from the main parent. I have the following structure categories on my website: - Category level 1 -- ...
3
votes
1answer
45 views

How to order by post_status?

I'm using get_posts() like this: $posts = get_posts(array('orderby' => 'post_status')) which is not possible cause it's not in the allowed keys in the parse_orderby() method How to get around ...
0
votes
2answers
854 views

Fatal error: Allowed memory size exhausted

I have a custom .csv generator functions that basically export data from posts and its post metas. The function works fine on this WP_query parameter: Array( [tax_query] => Array ( ...
0
votes
0answers
13 views

How to list posts of a given format

I want to create new urls in my wordpress that list posts of a given format and category. I thought the url structure would make sense to be like this: /[post-format]/[category], i.e.: ...
0
votes
2answers
565 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, ...
0
votes
1answer
26 views

WP_Query with meta_value LIKE 'something%'

I have read several questions like this (for example, this), but no equal. I WP_Query need to perform a LIKE on a meta_value. My problem is that I want the like is as follows: meta_value LIKE ...
1
vote
1answer
17 views

Display custom tags on pages that have a specific page parent

I would like to use Using the WP_Query or Query_Posts method. I'm currently using the query_post method. $terms_array = array(); if ($strurl == "somesite.com"){ $resparent = "18219"; //Page ID ...
0
votes
1answer
23 views

Wordpress Prevent 404 on missing custom post

The thing I am trying to achieve is to get data from a third party data source and display each piece of information as if it was a "post" in a WP theme. Now, the WP theme intrinsically works with ...
2
votes
1answer
64 views

Ignore/Skip default value on orderby menu_order?

Is there a way to query all pages and order them by menu_order but ignore those pages that the default value of 0? I was trying to do something like this: $the_query = array( ...
0
votes
1answer
31 views

Modifing archive query affects show post count function

I'm trying to modify the archive query of archive page with this function hooked to pre_get_posts action hook. // Load our function when hook is set add_action( 'pre_get_posts', ...
1
vote
2answers
1k views

Pagination doesn't work

I created myfile.php with the following content: global $paged; if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); } else if ( get_query_var( 'page' ) ) { $paged = ...
1
vote
2answers
490 views

twentyeleven_content_nav hook no longer outputs navigation link after 3.5 upgrade

After upgrading to 3.5, I discovered that navigation has disappeared outside of the main index page. Theme is TwentyEleven and I've verified that this still occurs after disabling all plugins. ...
2
votes
1answer
665 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
51 views

Custom post type and custom taxonomies display

I have the following CPT and Taxonomy in my WP: CPT: magazine Hierarchical: true Has Archive: true Custom Taxonomy: authorname (Magazine Author. Not the same as WP Author) Attached to: CPT ...
0
votes
1answer
585 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
1answer
2k views

posts_per_page is not working

I have a query to display custom post type categories' posts, but I want to limit the posts_per_page to 8, so I am using the code below. Please tell me, if I'm doing something wrong. <?php $args ...
1
vote
2answers
418 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
1answer
3k views

WP_Query class not found

The idea is simple. I have a drop-down menu generated with get_categories(). This outputs a list of categories in an unordered list, each in it's own li element. I'm getting the text values of those ...
2
votes
1answer
525 views

Pre_get_posts Gives 404 on Custom Post Type

I'm trying to filter the query on a sub page called "Ask Question" to list all of the recent questions submitted by users, but I get a 404 when going to the page. Flushing the permalink structure did ...
0
votes
0answers
29 views

Pagination on page.php with wp_query and query_posts

I'm trying to get pagination to work on a custom page.php and this has been kicking my butt... here is my site Here is my code: <!-- Page Blog Body Start ...
0
votes
0answers
18 views

pagination not working on page template

I am having a custom page for displaying community posts, where i want to display the posts posted in last 30 days sorted in desc order by meta value of post views which has to be greater than ...
0
votes
1answer
4k views

Get the number of rows from $wpdb->get_results not working

I want to count the number of rows of this custom wordpress query and it does not work: *PS I am accessing a custom table inside my wordpress database, mabe by myself. The $wpdb->get_results part ...
0
votes
0answers
31 views

WP_Query search by meta tags shows all results everytime

I'm using a search form with WP_Query to refine results of some custom post type. It's working well if I search by items but not with text input with . It shows all results: Code for the search ...
0
votes
1answer
35 views

WP_Query - Accessing MetaValue from Query Result

Have this code. In doing a var_dump the meta_value is being retrieved under public object meta_value. I'm trying to access this data in a "WordPress" away instead of a more traditional PHP way. What ...
0
votes
1answer
1k 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
1answer
54 views

Get pagination working for custom loops within page templates

I've got a custom loop for which I'd like pagination. The codex and examples I've found online indicate that I should get pagination as long as I pass the 'paged' query variable into the loop as the ...
0
votes
1answer
69 views

WP_Query based on URL parameters

I'm looking for some help in creating a query based on fields I made in Advanced Custom Fields. I'd like to create a query that would loop through a custom post type, using arguments such as: ...
0
votes
1answer
27 views

Adding a parameter to the default query

I'm using ACF to create a "Featured" post section of the index.php and I'm having trouble then excluding that post from the main query. <?php $tmp = $posts; $isPaged = ...
2
votes
1answer
87 views

Changing Posts Per Page and offset with pre_get_posts

I have a filter using pre_get_posts to change the number of posts per page from 4 on the news landing page to 8 on all other pages (page 2, 3, etc). However I don't seem to have got the offset ...
-1
votes
1answer
406 views

query_posts different amount of posts per page [duplicate]

I have a posts_per_page query to paginate multiple post types, which works great! Now though, as it paginates it to show (in this case) 100 posts per page, I'm wondering if you can show 100 on page ...
0
votes
0answers
45 views

How to query and group posts by category?

/* * Loop through Categories and Display Posts within */ $post_type = 'post'; // Get all the taxonomies for this post type $taxonomies = get_object_taxonomies( array( ...
0
votes
1answer
31 views

How to add multiple custom URL variables?

I am building a Wordpress plugin that looks for different custom variables in the URL. The way I am able to achieve that right now is with this code: function add_custom_query_var( $vars){ ...
0
votes
1answer
44 views

Using tax_query to get single post per category

I have a list of magazines I need to categorize and sort. I have created a custom post type and registered a custom taxonomy to organize them. Category Structure: Print Magazines (parent category) ...
2
votes
1answer
119 views

How to bring specific post to front of wordpress loop?

So, I have a WordPress loop going on. The below code is the template page for the woocommerce product archive page. Here's the use case for what I am trying to find out how to achieve: User is ...
0
votes
1answer
30 views

Creating a Tabbed Widget

I have setup my widget to retrieve data from custom post types. I am using WP Query to show the data, but it still not showing. I have also setup the file in a gist for easier lookup ...
2
votes
2answers
192 views

Conditional to modify query results

I'll admit, I'm not a PHP expert, nor am I familiar with all of the WordPress functions and hooks. I've been stuck on an issue, searching for help without much success, and I was hoping that someone ...
0
votes
1answer
24 views

WP_Query for CPT with filter by another WP_Query

I'm working on a project have 2 CPTs: Projects Units Every Unit has a meta value containining the id of Project Every Project is assigned a custom taxonomy named Regions Now I need get all Units ...