"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
9 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
13 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
6 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
0answers
13 views

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

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
17 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
14 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
16 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
18 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'] = ...
0
votes
2answers
42 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
43 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
8 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
36 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
0answers
16 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
61 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
28 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
22 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
18 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
24 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
9 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
17 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 [on hold]

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
11 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
34 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
30 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 ...
3
votes
2answers
87 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
14 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
5 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
22 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
25 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
21 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 ...
0
votes
0answers
13 views

Can I merge WP_Query and WP_Comment_Query together?

I have read about merging two WP_Query results. But I need to merge a WP_Query with a WP_Comment_Query and order the result by date. Is this possible? If so, how can I approach this? How would I ...
2
votes
2answers
103 views

Exclude first 5 posts of specific categories in the main loop

I read this article about how to set an offset for one specific category in the loop. I was wondering about if this was possible for more than just one category. My problem with the code suggested in ...
0
votes
0answers
19 views

Reduce or prevent calling of update_meta_cache

My theme calls the update_meta_cache() function 58 times per page! This function appears to run the following query based on the post in question: SELECT post_id, meta_key, meta_value -> FROM ...
4
votes
2answers
48 views

Exclude a category if post is only in that category using wp_Query

I have two categories Category1 (ID = 1) Category2 (ID = 2) I want to display posts Which are in Category2 and in (Category1 + Category2). If a post is only in Category1 then it should not ...
0
votes
1answer
23 views

Function to retrieve IDs of posts, cache results, and improve wp_query

I'm looking to optimize db performance by creating a function that retrieves IDs of posts in a certain category and caches results. So instead of having a query like: SELECT … WHERE 1=1 AND ...
0
votes
0answers
44 views

Optimize WP_Query

For the homepage WP_Query loop, I need to get the most recent 20 articles, specifically to display the page title, excerpt, category, and date. I am doing the following: $args = array( ...
0
votes
0answers
15 views

Displaying post form catagory saved in array

I am using option tree framework plugin.In my option, the catagory id is saved in array. The var_dump is as follows $tmq_social_items = ot_get_option( 'tmq_social_items' ); ...
0
votes
0answers
14 views

Show portfolio items in template - how?

I have made my archive-portfolio.php-file as desired and it works as it is supposed to. However, I don't want to use that file. I want to create a template, name it for instance cars-template.php and ...
0
votes
0answers
22 views

Using an actual page for 404 instead of a template

How would I override the 404 template and fetch a whole page instead? Currently I have achieved this by doing a http request from 404.php(the 404 template) to http://example.org/error404, which in ...
0
votes
1answer
21 views

Return on a quest all these meta_value

<?php if(isset($_REQUEST['src'])): $business = $_REQUEST['srcbusiness']; $type = $_REQUEST['srctype']; $price = $_REQUEST['srcprice']; $city = $_REQUEST['srccity']; ...
0
votes
1answer
24 views

Wordpress Query posts that have title > another title

I am trying to make a query of a custom post type that searches the next 3 posts alphabetical order after a specific title. A snippet of the args wp_query is $vars = array( 'paged' => $page, ...
0
votes
1answer
39 views

Add a custom variable to query page object

Is there a way to add a custom variable to the queried object? if (is_page()) { $q = get_queried_object(); $term_id = $q->term_id; } Here's some background on my setup. I have a page ...
0
votes
1answer
22 views

Searching for meta_key returns 0 posts

I am currently on a client project and I am stuck with the meta_key search in WP_Query. I am querying some other parts of the homepage successfully with the WP_Query class, but when I am passing ...
0
votes
0answers
38 views

New WP_Query calls Pre_get_posts filter twice

On my WP theme template page, I am running a new WP_Query. It seems to be calling my pre_get_posts filter twice, which then wrecks my custom parameters. The second time the pre_get_posts filter is ...
0
votes
0answers
20 views

Multiple Meta_Query using an array to search

I've got the following code from a previous developer which searches through a meta_key called new_location to match a location ID to a meta_value. It works fine for up to 3 different locations at ...