"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
13 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
8 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
12 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
16 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
31 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
22 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
23 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
23 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
15 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
16 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
13 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 ...
0
votes
1answer
17 views

pre_get_posts with get_posts

So in the template I've multiple featured posts and sliders and 2 default loops. I use get_posts for everything except default loops (obviously). Now the issue I'm having is excluding get_posts ...
0
votes
1answer
14 views

How to display the number of posts in a category using WP Query

Just a quick one but I am stuck in doing this. I am running a WP_Query for a category and and want to know how to display the number of posts in a category using WP Query! This is the start of my ...
0
votes
0answers
33 views

Function is creating too many queries

I have code that displays a list of categories and orders them by the number of ACTIVE posts in the category. This is determined by comparing the custom field of due date against the current date. If ...
0
votes
1answer
17 views

Overriding $wp_query on a template

What would be the disadvantages/problems of overriding a global variable, in this case the $wp_query? Example in template archive-books.php: get_header(); global $wp_query; $wp_query = new ...
0
votes
0answers
18 views

Call grand-children of page outside a loop?

I am knocking my head to a wall since couple of days, Here is the situation ( I attach a graphic to explain more clearly what I want): I have one main page-template. Who is the parent of three ...
0
votes
0answers
16 views

Comment form on page redirects back to frontpage

I have a page template with a single WP_Query what displays only one posts (Depends from the value of the $_GET. Example: domain.com/custom/?id=2). I would like to add a comments form I used ...
0
votes
1answer
10 views

Displaying the category name of a custom post type

So I have a custom query, in which I'm displaying some results posts of a custom post type called "staff". This custom post type is linked to a custom taxonomy called "department". I am able to ...
0
votes
1answer
37 views

's' term in WP_Query extended class causes huge memory leak (268MB)

I've used WP-Geo-Posts as a starting point for building a plugin which extends WooCommerce to support classifieds-like functionality. Using ACF I've associated products with a location (latitude and ...
0
votes
2answers
23 views

Limiting number of related posts

I'm trying to add a related posts section to the bottom of my single post views. It needs to grab the categories of the current post and show just 2 posts that match any of those categories. I'm ...
0
votes
2answers
18 views

Compare meta key separation

I have a meta key called $availability that can have one of four options but also multiple values separated by pipe: |. For example the value could be: severaltimes_week|oncetwice_month|occasionally. ...
0
votes
1answer
17 views

wp_query - show pages that have parent defined

Can I achieve this with wp_query? I only want to get pages that have parent selected. I'm using JSON API plugin and need to make a http request - would this be possible with url wp query also? For ...
0
votes
0answers
13 views

creating one page theme but templates are not being applied to page content on the “one”page.

I am creating a one page theme. I have a loop that puts the content from each page on a single page but it does not apply the temple for each individual page. Here is the loop I am using. <?php ...
1
vote
0answers
24 views

Slow WP_Query with 'OR' on meta_query

Essentially, I'm trying to query using a filter for the args being fed into WP_Query() like so: public function filter_wp_query( $args, $template_slug ) { $args['post_type'] = ...
-1
votes
2answers
51 views

Limit amount of pages shown in pagination within wp_query

I've got a query that looks like this: $args = array ( 'post_type' => $postType, 'paged' => $paged, 'pagination' => true, ...
0
votes
1answer
49 views

new WP_Query messes up pagination

I've been looking around for a solution to displaying a separate amount of posts specifically for the archive pages, and thought I had came up with some working code, however I see it messes up ...
0
votes
1answer
19 views

post_results filter confused by pagination in sidebar and main section

I have a post_results filter that I want to use to manipulate the results returned from a the query. Let's say that it's supposed to put stars around the first post on the first page, second post on ...
0
votes
0answers
10 views

multiscroll confusion in wordpress

I'm using multiscroll jquery plugin for multiscroll. here is the code from documentation of plugin.. <div id="multiscroll"> <div class="ms-left"> <div ...
0
votes
1answer
38 views

WP_Query shows all posts on single post pages

Looking for assistance with WP_Query. I'm learning to create WordPress themes and I am practicing by creating a real estate theme. What I am trying to do is set up a properties page (custom post type) ...
0
votes
1answer
23 views

Shortcode in a blog post, footer and related products stop working

I have a problem, I develop a shortcode, and it works fine just that when I put it in a blog post, footer and related products stop working. I show you my code I hope you can help me. <?php ...
0
votes
1answer
65 views

Query using string from custom field as array value

Firstly, what I am trying to do is display posts from Category x on posts from Category y where text from a custom field on post from Cat y matches text from one of 2 custom fields on cat x. I am ...
1
vote
0answers
24 views

Add Custom Post Type of specific Custom Taxonomy to regularly blog loop

I want to add a CPT to be shown in the blog. I figured out that I can use the filter hook pre_get_post to get the query object and I can modify it. However just adding another post type to the loop is ...
1
vote
0answers
29 views

Meta Queries - should nesting work after WP 4.1?

I have a rather huge meta_query here and it hangs at execution: browser just won't load the page, it goes on loading ... As far as I know this should work after WP 4.1 (I have it). Also tried ...
0
votes
1answer
33 views

Get newest value of an array

I would like to show custom posts as an "issues" page. I can hard code the 'terms', e.g. issue-3, but how can I display just the newest one? $the_query = new WP_Query( array( 'post_type' ...
0
votes
1answer
25 views

Display Count of posts

I'm trying to create a counter that will display the page number followed by the page count of a category page, where there is 1 post per page. For example if there are 10 posts in a category: 1/10, ...
0
votes
1answer
19 views

How to filter sql only for a specific post type

I have been trying to join a custom table with a regular wordpress query, but only under a specific condition (a specific post type). I have a single-event.php template that runs the main query, and ...
0
votes
1answer
28 views

Get results from the main wp_query

I would like to alter the main wp_query and then email the results as PDF or HTML email. I have managed to filter wp_query using custom filters and some code similar to this inside my plugins ...
0
votes
1answer
29 views

Plugin does not create a custom table upon activation

I have a problem as the title says. My plugin does not create a custom table when it's activated. My code is: function bsp_create_update_table() { global $wpdb; //geting the acces to a wp tables ...
0
votes
1answer
10 views

Get all custom posts with a certain taxonomy

So the site i am working on has a Custom Post type of "Case Results" and one of the columns is "Type of Case". On a certain page I need to get all of these "Case Results with a "Type of Case" of ...
0
votes
0answers
20 views

previous_posts_link not working in WordPress pagination

I'm using a custom query in my front page to show some posts from a category. it ll be selected by the admin from backend(using redux framework to do that). Now when I click older entries ...
0
votes
0answers
8 views

wordpress wp_query with redux option is not working [closed]

I want to have the ability to choose a category from theme option panel & it ll show all the posts from that exact particular category. so I have setup my wp_query like this: <?php ...
0
votes
0answers
12 views

Eliminate typical pages on search page, turn it into ajax search with “infinite” sized single page

I'm trying to change the default behaviour or WP search page, I have hidden the paging links, and added a button("more results") that sends an ajax request, but I'm not sure how to handle this ...
2
votes
0answers
42 views

Custom WP_Query order by post_meta and (author) user_meta

I am having an issue that i couldn't find on google and elsewhere. To put problem in the context. I am making a wordpress site where user can put their tutor listing for giving a tutorials, and i am ...
0
votes
1answer
32 views

Add parameter to first post only

I've set up a custom post type called "Videos". I have assigned an ACF oEmbed custom field to "Videos". On the archive page, I have a loop which queries the custom post type and displays all of the ...
4
votes
2answers
97 views

Query Multiple Post types each with own meta query

I have 2 post types: lets say products and product_variations. I'd like to be able to modify the query via pre_get_posts to get all product with meta_keys "_visible" = "true" and "_available" = "true" ...
0
votes
0answers
17 views

Get posts with parent post that have specific meta value

I am not sure if this can be done with wp query but here goes. My guess it would need a SELF JOIN but no idea how to start. Consider this example. I need a set of post who have a meta value of foo ...
0
votes
0answers
6 views

Show h1 intro, while outside my shortcode output

How I can add my h1 heading out ?, but not from inside the loop. Each output has a <div class="relacional"> but I want to have a h1 that falls outside the loo and that above all <div ...
0
votes
1answer
23 views

Navigation for custom loop

I have a website I'm working on with 3 custom loops next to each other: Station LV I need separate navigation for older posts for each loop. But I'm having problems seting it up: <?php ...
0
votes
2answers
27 views

Creating attachments archive in tags and categories

Per this question (How to create an attachments archive with working pagination?), I've been using the following function to have archive pages display attachments as well as pages and posts. It was ...
0
votes
1answer
25 views

Date query for a custom meta field

I would like to use something similar to the following date_query but I would like to use some custom meta fields instead of the existing post columns. For example instead of post_date_gmt I would ...