"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
39 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
31 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
19 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
32 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
32 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
35 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
26 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
29 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
37 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
64 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
56 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
66 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
38 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
44 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
73 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
54 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
72 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
35 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
98 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
81 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
57 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
41 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
47 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
106 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
56 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
41 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
35 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( ...
0
votes
4answers
56 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
22 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
60 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
285 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
103 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
37 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
102 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
35 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
50 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
102 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 = ...
0
votes
0answers
19 views

Query Database for URL

I have a multisite setup and was wondering how I can query a database to find and retrieve a URL if it exists, otherwise, don't output anything... For example, using the two following domains which ...
0
votes
1answer
61 views

meta_query not working with the_content()

I have two custom post types: events and venue. I'm trying to query related events into the venue page. I have the related variable stored in a custom field for venues and the events related value in ...
1
vote
0answers
27 views

Pagination inside of a edit page

I looked all over for this and could not find the answer I have two custom post types one is named 'venues' and the other is 'events' every 'venue' has multiple 'events' relating to it. I have a ...
0
votes
1answer
119 views

Using Wp_Query, Json to add Highcharts series data

I just added a custom Highchart to my wordpress single custom archive page. http://propertywise.malisa.agency/en/district/khlong-toei-2/ Using the following function call from within the Highcharts ...
1
vote
0answers
48 views

Combine two queries into one to use in loop

I have two queries. Simplified versions are the following: // First query $args1 = array( 'post_type' => array('post'), 'cat' => '-48', ...
0
votes
1answer
52 views

3 wp_query on one page with pagination for last query

I am trying to create a page with three wp_queries. The first query pulls the first 2 articles of a given category, the second pulls the next three from the same category (offset 2 in $args) and the ...
1
vote
0answers
34 views

How can I create a WP_Query that returns posts where one meta_value <= another meta_value

I have a working, pretty complex SQL query hand-written in a function. For the sake of leveraging WP_Query optimizations, and simplifying my code for maintainability, I'd like to convert it all to ...
1
vote
1answer
168 views

Pagination with 5 posts per page

I'm trying to create a paginated list of posts, and have used the Codex to write some code but I appear to be doing something wrong. These are my wp_query args $paged = ( get_query_var( 'paged' ) ) ...
0
votes
2answers
51 views

How to create posts (not post template) to be displayed on projects page?

Pages : Home - set as static home page; blog - for blog posts; About ; Contact; Projects; List of templates: front-page.php - for Home page; home.php - for blog page; about.php; contact.php; ...
0
votes
1answer
53 views

insert thumbnail image from php script

I'm trying to insert a post image thumbnail from my php scritp. It's inserting the post, the content, a download link, and I only need to set the thumbnail image to finish my script. This is my code ...
0
votes
0answers
25 views

Empty pagination pages

I have a category file called category-exhibitions.php where I loop the exhibition category. Now I need the pagination there also, I am trying this but it gives me blank pages when I navigate to page ...