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

meta_query not working as expected

I have 3 posts that each have two meta values. The first meta value is one that they all share (ac_parent_event). The second is one that is unique to that post (ac_thischild_date). For this function, ...
0
votes
1answer
28 views

Moving the array pointer inside a WP_Query while loop

How can I move the pointer ahead a place, or at least offset it, as I'm trying to pull two posts during each loop of the while loop? I've indicated where in the loop I would like to move the pointer: ...
0
votes
0answers
13 views

Search Post Types and the Meta Boxes

I have meta box called (orginalday), This i will save the post day when the user write post and save it in (pending), And i have form that have 2 input type to search post from day to day. So i need ...
0
votes
0answers
13 views

Query Search Not Working for Users

When I search for a User by their first name, all of their posts show up in the dashboard. When I search for that same User and add their last name, it does not show up at all. Not sure why this is ...
0
votes
2answers
26 views

Get Category Archive Template Name Dynamically

I'm making a category archive template that works for all my categories. I need to dynamically set the 'category' parameter of WP_Query inside of this template to make it work. How do I dynamically ...
0
votes
1answer
19 views

custom page with post content using read more

I have a code for a custom page i'm creating that I want to have my own blog archive (formatted customized) this is my code: <?php ...
0
votes
0answers
21 views

Blog only showing one post even though more published

Why is my wordpress blog.php only showing one blog entry while I have two entrys in the blog at present and have checked both are published and they are and yes i do have my reading setup to my blog ...
-3
votes
2answers
33 views

Undefined variable [closed]

I have created a shortcode for a custom post type query but when I add meta_query values to it, it throws an error: Notice: Undefined variable: my in ...
1
vote
1answer
40 views

WP_Query arguments to fetch custom post type posts which are in certain category?

I've played around for hours but still can't wrap my head around the right arguments for a secondary WP_Query which shall fetch all posts of my_custom_post_type that are in the queried category. ...
0
votes
1answer
40 views

wpdb get_results() returns only 2 rows

I am trying to create custom admin widget to present how many users has registered within last days. I have created function as below: function mdbootstrap_add_dashboard_recent_users(){ global ...
0
votes
1answer
31 views

wp_delete_post deletes all posts instead of just expired ones

I am trying to set up a cron job which deletes posts which have past their expiry date (i.e expiry date < today's date). I have a meta box on the custom post type which adds an expiry date to the ...
0
votes
1answer
25 views

Keeping the previous get value and add another value when submitted

I'm a super noob, so I'll try my best to explain. I have a blog page that I wanted filtered by category and I want the user to able to click on multiple categories and it will filter to show those ...
0
votes
0answers
11 views

WPML: Custom query looping through languages & putting out one post each round

For a current project I use WPML to distinguish between languages and to manage authors/editors and what they are allowed to write and translate. While there are different language versions of the ...
0
votes
0answers
24 views

Keeping checkboxes checked WP_query

I have wp_query that allows the end user to filter the query using checkboxes. This works fine until pagination, all the user checked checkboxes get cleared on page 2 how do I get checkboxes to carry ...
0
votes
0answers
19 views

Filter by custom field - dropdown POST not working

I have a custom field "carbz" which has a number value. I am trying to give users a dropdown to select a number and then filter my posts based on the user's input. The current result is returning all ...
0
votes
2answers
30 views

Select posts wich has no relationship in custom taxonomy

I can select posts via my custom taxonomy as explained in the codex. But I am not sure, how I have to set up the tax_query if I want to get only posts which have no relation in the custom taxonomy at ...
0
votes
1answer
20 views

Duplicates When using Nested WP_Query

I think I'm missing something really simple but I'm at my wits end and hoping to be pointed in the right direction. A little background. I'm working on a site for a creative agency. I'm using ...
1
vote
1answer
25 views

Multiple Loops Inside a Function

What I understand from the CODEX, (https://codex.wordpress.org/Class_Reference/WP_Query#Multiple_Loops). then I'm trying to do a list of posts like this: <nav id="cbp-hrmenu" class="cbp-hrmenu ...
0
votes
2answers
25 views

Link Author URL's based on a custom field

I'm querying a custom field of users based on a city they are in. I am able to display their profile photo and display name, however I can't seem to get the link to their actual author url to work. ...
1
vote
1answer
39 views

Order posts by meta value and Date

I'm trying to sort posts based on one post meta value and date. I'm using this plugin ( https://github.com/JonMasterson/WordPress-Post-Like-System ) to add like system to my posts. The code that ...
1
vote
2answers
40 views

Display certain amount of posts on taxonomy archive page

I have a taxonomy archive page where I display everything under the term 'techno' I want to be able to limit this to 20 posts to a page until it paginates. At the moment it displays 10 on one page and ...
1
vote
0answers
29 views

ajax category filter

I know this is a big ask for you guys, but i can't seem to figure this out. I found this page : http://www.bobz.co/ajax-filter-posts-tag/#comment-28112 it shows how to make a dynamic filter for post ...
0
votes
1answer
35 views

WP_Query get post from a category and from another post type

I have 2 post types (post and help). In post (post type), there is a category named "Hello" and I want to get all posts from the category "Hello" (post_type = post and category_id = 2) and all posts ...
1
vote
1answer
24 views

Get a post from other loop each n-posts in the main loop

Here's the layout, I'd like to achieve. 1st row: three posts in three columns from category A 2nd row: one fullwidth post from category B 3rd row: the next three posts from category A 4th row: ...
1
vote
2answers
54 views

How to limit WP_Query to one result on the loop?

I am trying to get only one post and this needs to be the latest one so here is what I am doing: $basic_args = $wp_query->query_vars; $basic_args['tax_query'] = $wp_query->tax_query; ...
0
votes
2answers
45 views

Transients with dynamic WP_Query

I have a <form> with about 20 inputs (mostly select and number) which each is an argument in WP_Query if filled. I learned today that I could use transients to store results which seems like a ...
4
votes
1answer
65 views

WP_Query - filter or directly?

The count of my files, templates, scripts, queries etc is getting big and I need a good system to maintain it all. I've tried to keep everything organized: No <script> tags in templates ...
-1
votes
1answer
30 views

How to create a loop inside WP_Query?

I want print array in a loop and want to put it inside WP_Query. Is it Possible? If there are other alternatives kindly mention it. $wp_user_query = new WP_User_Query(array('role' => ...
0
votes
1answer
58 views

Display List Of Posts Containing a Relationship Field Value [ACF]

I have a post type called 'Writers' and another post type called 'Documents'. I use the Relationship field in Advanced Custom Fields to link a list of Writers (post objects) to a Document. This means ...
-1
votes
1answer
29 views

how to show only catergory titles on a page in wordpress

How do you show category titles on a page in wordpress. I want to to show the category titles on my home page which would then link to the first post in that category. I also want to show the image of ...
1
vote
0answers
47 views

get posts by meta_key from inside key of post meta

How can i get posts sorted out by meta_key from inner key array of post meta values, for more details please look at my code: // Example output of each post_meta, key is views array( 'all' ...
1
vote
1answer
43 views

WP_Query loop within WP_Query loop

I'm trying to use a custom WP_Query loop within another one to display data from the inner loop independently from the main loop. I found this solution but don't really understand how to use it. Here ...
0
votes
1answer
35 views

Hacking 'posts_per_page' in WP_Query

I have a search form, a map and results section. Search form is submitted with different parameters Map shows ALL the results that match the parameters Results section shows first 15 results that ...
0
votes
1answer
37 views

Orderby modified only for specific post types

Here is my WP_Query in which I want to fetch data from multiple custom post types and order them by the modified date: $args = array( 'post_type' => array( 'staff-updates', 'employees', ...
1
vote
1answer
80 views

WP_Query times out

I have a form with 20 inputs that runs WP_Query and recieves results via ajax. For some reason: query gets considerably slower when 5+ inputs are filled It takes like 10 - 15s with 7 input values ...
3
votes
1answer
51 views

Compile two queries to one set of results?

I've got a big query that queries one post_type with all different kinds of filters. Values are taken from <form> inputs. Im adding 3 different checkboxes to the <form> which can be used ...
1
vote
1answer
39 views

Automatic post deletion

I've built a system where I have 2 options - lifespawn of draft and lifespawn of published post (integer which marks days). If post is being published, exact date-time of publish is saved as ...
1
vote
1answer
32 views

Wp_query Add specific pending posts

I want to retrieve in archive all the posts with post_status-> publish and those with post_status->pending of specific user. That's where i'm now: $custom_query_args = array( array( ...
1
vote
0answers
78 views

paginate_links() and ajax

I've got a working query with working pagination but I would need to load these pages via ajax. Here's a simple demonstration: Question: If: default page is www.my-site.com/search/ second page ...
0
votes
4answers
35 views

wp_posts table: safely remove unused columns to save database storage

i search about it on google but didn't find any thing. I want to remove my wordpress wp_posts table's unused columns, to save my database storage... I know if table column is empty it will not ...
-2
votes
1answer
20 views

Show post like this image in my newssite [closed]

I want to know how to query like this photo in my newssite for a category. See this image and help by give the query code. Do I use Offset or if else. How to query for this .
0
votes
2answers
46 views

WP Query crashes on more than ~ 2000 posts

Hello there for a custom post type "organizations" I have about 5000 posts which have to be shown in a list with link within one page. However WP_Query just crashes (without PHP timeout just after 4 ...
10
votes
1answer
234 views

Custom taxonomy query broken after upgrade to 4.4

I just upgraded from 4.2 to 4.4 and now my taxonomy query returns empty. It has been working fine prior to the upgrade. I have registered a custom taxonomy named 'title', which is used by my custom ...
0
votes
1answer
70 views

The pagination on index.php doesn't work on a first page

I have index.php with a pagination. The permalink settings is plain permalinks. I have a correct pagination view when I open a page '/?paged=2' but if I open just index.php I have all posts without ...
1
vote
0answers
21 views

WP_Query's “request” SQL Query

Lets say that I want to use a MongoDB for searching. I saw that WP_Query has a property named request which it seems that holds the SQL Query which is executed on the SQL database. Now if I write a ...
0
votes
0answers
33 views

Include in post navigation if field is checked

I need to display certain posts in the previous and next buttons using the_post_navigation() function. I want to to exclude any post with a checkbox that is not ticked. Another twist is that the ...
0
votes
0answers
55 views

Help optimizing slow WP_Query with meta_query

I'm trying to create a custom WP_Query. Right now, I have two meta fields, roi_min and roi_max. The ideia is to get posts that has a roi_min greater than the selected value, and a roi_max lower than ...
0
votes
2answers
33 views

Wordpress custom field sorting, weird behavior: the latest post is at the end

I am using Wordpress with Advanced Custom Fields. I have a custom post called "event" with a custom field "date" (I have added the field through ACF). The date field is formatted in the following way: ...
0
votes
0answers
34 views

Custom Post Type - shows pagination (w/404) or posts_per_page query, not both

I have a custom post type of 'gallery', and I'm using a template for the archive of 'page-student-gallery.php'. My admin settings for posts shown is 5, I'd like it to show 9 on this page, of just ...
0
votes
0answers
64 views

Checking Taxonomy Terms for a Custom Post Type With get_the_terms Not Working

I'm trying to test the term for a post within a wp-query and for-loop. Everything works great however testing the terms via get_the_terms($post->ID, 'category') returns an empty array. $terms = ...