"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
0answers
7 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
0answers
2 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( ...
0
votes
0answers
15 views

wordpress remove where clause in taxonomy page [on hold]

My site has installed woocommerce. When I visit taxonomy page, the below SQL is executed SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = ...
0
votes
1answer
26 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
11 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
13 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 ...
0
votes
1answer
13 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' ); ...
0
votes
1answer
13 views

Cannot pull up posts of category on category page!

I have an extremely simple loop which I've placed in header.php: $my_query = new WP_Query('category_name=home'); while ($my_query->have_posts()) : $my_query->the_post(); whatever(); endwhile; ...
1
vote
2answers
40 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 ...
5
votes
2answers
199 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
10 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 ...
0
votes
3answers
30 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 ...
-1
votes
0answers
32 views

Is it possible to use meta_query with both AND and OR relations? [duplicate]

$args['meta_query'] = array ( 'relation'=>'AND', array( 'key' => 'canonical', 'compare' => 'NOT EXISTS' ), array ( ...
4
votes
1answer
43 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
0answers
26 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
15 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
22 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
0answers
15 views

Reference parent page ID and children from child 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 ...
0
votes
0answers
12 views

WP_Query Meta_key is text value and need to sort as numeric not working

I have the following code below in my ~WP_Query`. $args[ 'meta_key'] = 'price'; $args['orderby'] = 'meta_value meta_value_num'; $args['order'] = 'ASC'; The custom field in question has historic ...
-1
votes
1answer
49 views

WooCommerce advanced custom filtering by attributes of variable products [on hold]

I created own solution for this. I will post it here soon. Is it possible to do extra filtering over posts this way or how should I do this? Basically, I'm doing filtering by variable products ...
0
votes
0answers
13 views

Sort CPT by first letter of a meta field in a specific range

'I'm working on a way to display member profiles (Custom post type) sorted by the first letter of their last name in a given range. For example all members with a last name starting with 'A' up to ...
0
votes
1answer
16 views

Meta query for comparing two dates

I want to list all users who registered in between the $start_date and $end_date.I have written a metaquery,but it returns empty.Please help. $start_date = 2014-08-16 09:28:17 $end_date ...
0
votes
0answers
40 views

Advanced wp_query - custom date and postname

I'm trying to write a query and sort by: custom date postname (in reverse order) because my postnames have a version string at the end and the latest entry should stay on the top of each other. ...
-1
votes
0answers
28 views

Post Type query [closed]

I have created a Post type category with name vehicles.Under the vehicles i also create four type categories, 1-pantech 2-vans 3-utes 4-tippera and inserted each category data how to find current ...
0
votes
1answer
16 views

foreach,having wp_query inside, breaks after showing one result

I am trying to make category tabs that show posts from selected category tab. I have tried it my way but m getting only one post for each category, whereas it should return all post in that category. ...
0
votes
1answer
37 views

Values inside a custom field to determine which category posts to display

I am facing a little problem whilst trying to display posts, from certain categories, on the front end. I've created a custom field whose key is 'related_categories' and I've different categories with ...
0
votes
1answer
27 views

Why category__in isn't working? [on hold]

I search bug in plugin (membership, provide access rules for users). The plugin adds a filter to WP_Query. All functions work, but the category filter is not working. On the generated WP_Query, ...
0
votes
2answers
22 views

How to make “Blog pages show at most” setting not affect custom queries

I want my blog page to display 5 posts at most. But I have many custom queries (wp_query) on my site, some of them embedded together: how to make Settings > Reading > Blog pages show at most ...
0
votes
1answer
15 views

How do I get my custom query to work with search results after the first page?

I am using a custom query in order to ajax load/append additional posts instead of paginating them out like WP defaults. However, when I click the button I've made to load more posts, it loads all ...
0
votes
0answers
49 views

70.000 custom posts on my site

My site have more than 70.000 custom posts. Admin panel not show all posts. how to fix it ? Month filter: more than 4.000 posts. it's normal.
0
votes
0answers
14 views

404 page is not querying my custom post

I have a 404 template page which is, obviously, designed for Not Found Pages. Within the code, I have the get_header(); where I place the global code for the site. There is a div that contains a style ...
1
vote
0answers
24 views

Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy

I have registered a custom post type "Animals" and also two custom taxonomies ("Vertebrate" and "Type") assigned to it, which have their own specific terms, for "Vertebrate" it will be "Mammals" and ...
2
votes
1answer
109 views
+50

WP Cron and wp_insert_post

I'm trying to insert posts using a cron job, but I keep running into errors where WP is missing functions (is_user_logged_in, wp_get_current_user). Is there a proper way to run wp_insert_post using a ...
0
votes
1answer
24 views

Can't display shortcode in WP_Query loop

I want to display all posts from my CPT brand. My WP_Query loop works well but the shortcode I want to use within it doesn't work. This shortcode comes with some plugin called Download Attachments, ...
0
votes
0answers
13 views

get_terms vs wp_query for pages - results inconsistent

I have a situation where a custom post type, with a related custom taxonomy. There are somewhere in the realm of 100 of these posts. The taxonomy associated to it has about 20 terms associated with ...
0
votes
0answers
22 views

Filter WP_Query output before it is accessed (pre_get_posts)?

I have read Using pre_get_posts with WP_Query and I'm not sure where to go with it. I have a recent posts plugin which adds variables to WP_Query - one of which can be 'offset' posts. The problem is ...
0
votes
1answer
30 views

Custom post type archive organized by category

I'm trying to display a custom post type archive page which displays all the articles of a a custom post type in columns. The columns organize them in their assigned category. On the main page, I do ...
4
votes
1answer
87 views

Inject post (from specific category) between posts in Loop

I would like to add a post (from specific category) between posts in the WordPress Loop (such as 'Sponsors'). Example: P P P S P P S P P S P P How can I achieve this? I am a beginner with coding, so ...
1
vote
1answer
27 views

How to create a custom shortcode based on the layout?

Hi I am developing a custom post type plugins. Which has shortcode support. Already i have created a shortcode which is going to use for default layout design. Again i have to create a onemore ...
0
votes
0answers
23 views

Display related posts with same category or same tag return blank

I'm trying to display 4 related posted in the same category or have the same tag with the current post on the single post page. The result is just blank. <?php $rCateogry = ...
0
votes
1answer
39 views

Pagination on category page with custom post types

Wordpress is not new for me but I am really stuck on this piece of code that I can not get to work properly. I register a custom post type News and let the custom post type use the Wordpress ...
0
votes
1answer
32 views

The sorting of posts by a meta_query with two keys fails while separated as single queries it works

I have a list of courses I try to sort. For sorting purpose I want to use two advanced custom fields. First a select field class_day containing the days: 1 : Mon 2 : Tue 3 : Wed 4 : Thu 5 : Fri 6 : ...
0
votes
1answer
20 views

foreach loop inside the loop creating duplicates in output

I have a foreach loop inside the loop that is getting info from a separate table. The table has a column that has an id that reflects the id of the post type so it should always be unique. When I ...
1
vote
1answer
22 views

Filter Posts from the Main Query

I want to conditionally merge a custom post type with my posts post type, based on a custom field. If the field's value is 1, then I want I need those custom posts to appear in the same loop as posts ...
0
votes
0answers
16 views

Displaying four post types sharing one taxonomy

I was hoping somebody could help me. I've created a custom taxonomy 'members' that is shared by four post types - posts, pages, resources, and news. I've then added five terms using this 'members' ...
3
votes
1answer
40 views

WP_query taxonomy + get all posts with two terms from same taxonomy

This is a follow up question to Add_query_arg + two times the same argument? I want to get the post count from all posts tagged with 2 different tags from same taxonomy $args2 = array( ...
0
votes
1answer
13 views

How to show the posts list into a static page? Problems to use the loop into a static page

I have the following problem: I have to create a posts archive into a static page. So I have created this page template containing the loop to interate on my posts: <?php /** * Template Name: ...
0
votes
0answers
72 views

How to load more custom type posts through AJAX & LOAD MORE POSTS button

Guys I am a little stuck here. Unable to load posts from a custom post type through AJAX. Normally I have had been using this script http://goo.gl/lwfM5 It seems so that $wp_query is not getting the ...
0
votes
0answers
29 views

Memory size exhausted when extending WP_Query

I tried to create a class that extends WP_Query, but I got this error: Allowed memory size of 1073741824 bytes exhausted I've increased the memory size in wp-config.php but that doesn't affect. ...
4
votes
2answers
120 views

count posts from custom taxonomy terms by year

I want to build statistics-like tables with the count of posts in given custom taxonomy terms and display them by year along with the total post count from that year. For example: 2014 ...