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

/page/2/ not showing

I am having a weird issue where when clicking on the pagination links the page just refreshes. The links are pointing to the proper pages(/page/2/) but when clicked, they do not show in the url. This ...
0
votes
2answers
48 views

How do I check if there is a tag in the title

I have many post with multiple tags ex: AMOS LEE, FOO FIGHTERS,TAYLOR SWIFT Post only have one of the tags in the title ex: “The Man Who Wants You” – Amos Lee How would I scan the_title() and go ...
0
votes
1answer
36 views

Using get_term_by to get tag id

I want to get posts that do not have a certain tag. I am having trouble retrieving the tag-id. The term id comes up as 0. Here is my code: $tag_name = 'my-sticky'; $tag = get_term_by( 'name', ...
0
votes
0answers
23 views

WP Query - Group by relation (custom post type)

I have a custom post type Office. An office has an address, email, ... . An office also has a relation with a custom post type Region. So an Office must have a relation with a relation with one ...
0
votes
1answer
19 views

Archive - Show Page Month Headers

Trying to output posts on an archive page with date titles. Ideally this can be a single query so I can paginate the archive. Currently I can call multiple queries for each date item but I don't think ...
0
votes
1answer
40 views

option select form always deleting the sql query

I have this form: <tr class="user-statusz-wrap"> <th><label for="statusz"><?php _e('Státusz') ?></label></th> <td> <select type="text" ...
0
votes
1answer
24 views

WP_Query within save_post doesn't include the item that triggered the action?

I'm using Advanced Custom Field's acf_form function to expose a front-end form for users to post content on the website. Users will be submitting photos of redfish they have caught, and one of the ...
0
votes
1answer
46 views

WP_Query inside an existing wp_query stops next post showing

I have a query that is showing the 5 latest posts on my homepage from the blog. After the second post I have added a div #more-news then the posts carry on in order after this. This was all working ...
0
votes
1answer
24 views

Create query for both custom post type and category

I have a custom post type called articles and have category = news I want to make a query from the two parts to get content from (cpt=articles, category=news) in the same query? How can I achieve ...
0
votes
0answers
28 views

Restrict a query for custom field

I am using a plug in, which stores tickets as posts (Awesome Support Plugin) in the plugin classes, there is a function to restrict the tickets loading in the admin panel, basically to show tickets ...
0
votes
0answers
30 views

How to filter Wordpress menu by tag name of the post

I have a simple wordpress theme installed on my server. The url is : http://urhalpool.com/wp/ I have used tagging against my post and those post added to my top and left menu. When I am filtering by ...
1
vote
1answer
45 views

WP_Query returning no results

I have the following code to merge 3 different queries: <div class="features-list"> <?php $args1 = array ( 'post_type' => 'page', ...
6
votes
2answers
94 views

Whats the difference between post_limits and pre_get_posts?

Because of the lack of documentation about post_limits, its hard to learn more about this function and when to use it. Never used it before or seen it used so maybe its not to be used? function ...
-1
votes
1answer
43 views

Showing specific post in order of array wp_query

I have displayed some specific post ID's in a custom template with wp_query. I am struggling to figure out how to make these in order. I want to show 1682 first and 1540 last. They do not show this ...
0
votes
3answers
28 views

wp_query get attachments in larger size

I'm using wp_query to get all attachments, and it works, but I wonder how could I get attachments in full size because this query returns images in medium. <?php $args = array('post_status' ...
0
votes
0answers
15 views

I wan to process the following js to process the AJAX Request on my function to calculate author Total Post views

This is my Ajax Handler function function get_total_post(user_ID) { jQuery.ajax({ type: 'post', url: ajaxforall.ajaxurl, cache: false, data: { action: ...
0
votes
1answer
33 views

Search format not matching taxonomy query

I have inherited some code in this project. This search works. I can click on each individual taxonomy and see the results displayed on my page. However, I would like this to extend the search rather ...
0
votes
0answers
37 views

Most view topic posted in last 24 hours

I have this query to get most post views. I want to retrieve top 3 most viewed topic which are posted in last 24 hours. If the website gets less than 3 topics from last 24 hours it has to retrive the ...
0
votes
0answers
25 views

WP_Query to show post from a category OR custom field - Not 100% answered

Regarding answer provided by birgirethis to this post: wp-query-to-show-post-from-a-category-or-custom-field I found one issue with your solution. The two inner joins (term_relationships and ...
0
votes
1answer
29 views

Display post meta conditionally based on it's value

I have a custom field that's a radio button with 3 choices (yes, no, other). What I'd like to do is the following: [If custom field value is yes] Display something here [elseIf custom field value ...
0
votes
2answers
41 views

Force Wordpress to be more random

I use a random wp_query to load 3 posts from over 600 posts in total with this query. <?php $args = array( 'post_type' => 'post', 'cat' => ...
0
votes
0answers
33 views

Correct Way To Run Multiple Queries Sharing Some Base Data

I need to run three queries on the same page. The 'core' query is the same all three times - selecting posts in a particular taxonomy. I then need to run three queries on that subset looking for ...
0
votes
1answer
35 views

(How) Can I use 'wild cards' on the left hand side of an array argument?

I've spent all day trying to work out how to do this, and have only advanced a little - and that's mainly in finding methods that DON'T work. Am hoping someone knows something or can see something ...
0
votes
1answer
21 views

how to query for meta_value have array

I have array in post_meta like this: array( 'option1' => 'true', 'option2' => 'true', 'option3' => 'false', option4' => 'true', 'option5' => 'false' ) and I would ...
0
votes
0answers
21 views

Infinite scoll on search page not working

i have implemented infinite scroll feature to my custom wordpress theme which is working fine on home/index page but i search page of my theme the infinite scroll is not working properly. The Problem ...
0
votes
1answer
37 views

Reset Wordpress Post Query to default

i am in a situation, i am creating a custom wordpress theme but i am stuck over something. in my index/home page, firstly i am displaying 6 posts by category like below <?php $posts = ...
1
vote
1answer
71 views

WP_Query doesn't get sticky post at the top, when used in a page template

I'm creating a theme in which I've created a page template called page_default-blog.php to be used for creating a blog page. In this file I have the following code: $paged = (get_query_var('page')) ? ...
1
vote
1answer
93 views

Prevent duplicate post from dynamic multiple loops

I was trying to list 20 recent posts, and put a post from custom post type on every 5th item. So it's like: Post Post Post Post Post Custom Post Type Post Post Post Post Post Custom Post Type .. and ...
0
votes
2answers
37 views

pass parameters through variable to WP_QUERY

I'm trying to use the plugin PrivateContent to limit access to certain pages/categories. I have a function (getAllowedCategories()) which reads PrivateContent access levels for the current user and ...
0
votes
2answers
74 views

Show only one post for each author ( Page loads too slow )

I want to show only one latest post by each author and found this code that it working. However, it takes too long to load the page since I have over 100K authors and 100K posts in database. How can I ...
1
vote
2answers
19 views

Get rewrite result

Quick simple question. How would I get the result of a rewrite in wordpress? For example I have: www.some.website.com/some/parameter How would I get the end result that WP processes? Aka, the ...
0
votes
1answer
305 views

Ajax load more posts - WP_Query parameters not working

I'm trying to replace the standard WP pagination with an Ajax load more posts button. I'm basically following the code from this question which for the most part works well. Here's the relevant ...
0
votes
1answer
40 views

Is it possible to add query parameters on the archive page?

I have a custom post type (works), and an archive page (archive-works.php). I would like to hide the non-public posts from the archive page, so I added a custom meta box. I also modified the query to ...
1
vote
3answers
30 views

Not getting author rank when using return

I am implementing a section in my website to get the top 5 authors using this code. function ranked_authors(){ $usrs = get_users('role=contributor'); $countarr = array(); foreach ($usrs as ...
0
votes
1answer
29 views

Querying by taxonomy vs Querying by Custom fields Speed Comparison

I'm developing a listing portfolio for our project. (Basicaly yachts with their type, size, price, cabins, draft, build year, refit year etc.) I should filter them according to type and sort by ...
0
votes
0answers
26 views

How to make the default Wordpress search return borader results

I'm displaying the results of a search query on one of my custom pages. The query is simple: $shopArgs = array( 's' => get_query_var('s'), 'post_type' => 'products', ...
0
votes
1answer
65 views

Exclude posts that only have the 'Uncategorized' category [duplicate]

I want to exclude posts that only have the Uncategorized category (i.e. category id 1), but if a post is (erroneously) categorised as "Uncategorized" but also has other categories, I want to include ...
1
vote
0answers
53 views

WP Query to have sticky posts first, with pagination and having a joint 'posts per page' arg with main loop

I am building a Wordpress site and have come to a bit of a wall while using a WP_Query, it started out quite simple but then sticky posts got thrown into the mix and it's becoming a bit harder to ...
3
votes
1answer
101 views

WP_Query to show post from a category OR custom field

I am looking for a way to show posts that belongs to a specific category or if they have a custom field. If I specify both parameter 'cat' => '9' and 'meta_key' => 'featured' in query arguments ...
0
votes
1answer
96 views

Using AJAX to return search form results

I'm trying to take user input from a search form, build a query based on user input, and then return relevant posts using AJAX. Right now, the form builds the select dropdowns properly. The form ...
0
votes
0answers
10 views

alter $post variable in main query as soon as possible [duplicate]

I'm using WP with WooCommerce. For some purpose, I want to load a predefined static page (e.g. with id=5) whenever the user enters a product page (e.g. www.mysite.com/?product=my-product), by ...
0
votes
1answer
33 views

Show posts of an advanced search form

I have created a search form with multiple fields, and I want to display the posts that match all the fields inserted in the search form. For example, if I choose T-shirt && Red && L, ...
0
votes
1answer
49 views

Wp redirect to url with ampersand string

i have a url like this: www.url.ui/?keyone=valueone&keytwo=valuetwo&ekythree=valuethree stored in a variable: $url = www.url.ui/?keyone=valueone&keytwo=valuetwo&keythree=valuethree ...
0
votes
1answer
70 views

WP_Query Group by Author and Order each group DESC

I'm trying to do a query where I get all the posts from a specific category, order/group them by author and in each group order the posts DESC. In the end the author with the newest post will be a the ...
0
votes
1answer
49 views

Multiple search queries on one page

I need to display results of three different search queries on one page. More precisely, there is a searchbox on my page where a user enters a search phrase. Once the search phrase is submitted, I ...
0
votes
1answer
41 views

Display posts if specific country

I'm running a simple query that displays some posts within a custom post type. Via each post within that post type, I've added an ACF True / False checkbox. If the checkbox is ticked, I'd like that ...
0
votes
1answer
39 views

What exactly does the 's' parameter search for in WP queries?

I have a simple question, but can't find the answer anywhere. What exactly does the 's' parameter search when used in a query? Ex: $args = array( 's' => $keyword ); $query = new ...
0
votes
0answers
27 views

wpdb giving different results then query in SQL Editor

I'm trying to read candidates and the relation with expertises from 2 custom tables in my WP Database. This is my WPDB query : $candidates = $wpdb->get_results(" SELECT * FROM ...
0
votes
1answer
56 views

Wordpress page and plugin list using sql query

I want to get all published pages and activated plugins of my word press site,i want all pages and plugin using mysql query.i don't want to copy paste all pages from wp admin.i want to get this list ...
0
votes
0answers
39 views

Display taxonomy title in my loop?

I'm using a tab to display my taxonomy, I would like to be able to display a specific taxonomy (for example: sectors) from my Custom post type. But my code doesnt seem to work . . .If any body has ...