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

Is it faster to query records using $wpdb instead of Wp_Query?

I mean the speed of query records from database, not the way we render the content gained. More specifically, I just want to query the posts' IDs, my site contains more than 4000 posts (they are ...
0
votes
0answers
12 views

How to get additional query parameters after a url rewrite

DISCLAIMER: Wordpress novice here. I'm trying perform a custom rewrite rule - and I believe Wordpress is stripping the additional query values from the rewritten url. example url: ...
0
votes
0answers
16 views

Order Custom Field by Price

First of all i've found numerous, topics, and, issues about ordering a WP_Query by its custom field value, but somehow all the proposed solutions don't seem to work for me. I have a custom field ...
0
votes
1answer
20 views

wp_query with cat not working

I am trying to retrieve some custom post type from their specific parent category. <div class="tab-content"> <?php $cat_menu = get_categories('taxonomy=menu_categorie&type=menus'); ...
0
votes
0answers
17 views

How to link a custom post type status to the user id

I'm currently trying to modify a plugin : Wp job manager application (addon). It allow user to reply via a form directly to a job proposal. After the user submit form. It's creating a custom post ...
0
votes
0answers
10 views

Meta Query Filter by Tag

I currently have multiple pages, and in each page is a custom field which is named 'country'. In the 'country' field I have this value 'uk, usa, brazil'. What I'm wanting to do is display posts on ...
-1
votes
1answer
27 views

Get list of posts which have at least one term from a custom taxonomy with WP_Query

Is it possible, with WP_Query, to get all posts which have at least one category or custom taxonomy term set?
1
vote
2answers
21 views

Include Sticky Posts in Page Post Count for custom query

This link solves the problem but it's only for the main query. What if you are using a custom query? How can you modify the answer below: add_action('pre_get_posts', 'ad_custom_query'); function ...
0
votes
1answer
38 views

Query Posts by Custom Field

I'm looking to query my posts via a custom field that I've created on my page. But the custom field is an array of values. So the custom field 'country' could look like this country => ...
0
votes
1answer
23 views

Custom WP_Query doesn't display all posts

I'm building an options page which allows users to choose three posts and three custom images that display on the site's front page. I am using the Settings API to create a custom WP_Query which pulls ...
0
votes
1answer
27 views

Query custom post type with tags

I created a custom post type named portfolio, and am trying to create a query to get similar posts from the portfolio post type based on if it has at least 1 similar tag. For some reason this code ...
0
votes
1answer
28 views

Use WP_Query in shortcode

I'm trying to get meta information from the first four posts that have a meta key equal to Sedan, then format that posts meta in order to set up gallery type display boxes. I believe it has something ...
0
votes
1answer
23 views

Inner join overrides Advanced Custom Fields plugin's get_field

I have this search that I made with inner join and where clause. I no longer get get_field() values, they all return false. How can I get ACF to work again? It must be something silly that I don't ...
0
votes
1answer
19 views

How to add div blocks after certain set of post

Ok I broke my post down into different style settings. Like shown below. The first post is a large block. the next four post are small and aligned next to the larger post. I used the loop below to ...
0
votes
0answers
19 views

How to solve this script problem in theme directory?

I have a jQuery Ajax call that calls a php script. This call works if the file is in the root of the site but does not work if this php script is in the theme folder . Additionally, I have a 500 error ...
0
votes
0answers
9 views

MySQL query in Functions.php using inner join to override/add to search

I'm setting up a radial geo-location search. I have users select a zipcode and a radius to search within. I want to use the regular search site.com?/s=abcd&zipcode=90210&radius=10 I look up ...
0
votes
0answers
13 views

WP_Query relation AND with two taxonomies and orderby rand, prioritising one taxonomy

I have a wp_query which selects posts from a CPT, using relation AND to select posts from two taxonomies (sector and expertise). I would like the order of posts returned to be random but I would still ...
1
vote
1answer
34 views

How to pass many ids in post__in?

I need to pass many ids to the parameter post__in in args. This not work !!! Help me please. foreach ($rows as $obj) { $todos .= $obj->ID . ","; } $ids = trim(trim($todos), ","); # echo ...
1
vote
1answer
48 views

How to use WP_Query to display many posts?

This is my WP_Query instruction but this not work. This display just first post. Help me please? // WP_Query arguments $args = array ( 'post_type' => 'teachers', 'p' => ...
0
votes
2answers
41 views

How to order WP_Query to group results?

I have a list of products in WooCommerce that have titles like so: Please note: The "groups" are just for myself, they are not categories etc. All products are the same type of product, just two ...
0
votes
0answers
11 views

Get custom meta box in custom post type using tag ID

I have a custom post type called Contacts, and in each of those post I have a custom meta box called number where a phone number is stored in each of the Contacts posts. I also have a custom taxonomy ...
0
votes
1answer
30 views

WP Query to Get Array of Slugs

So I will be using a template where posts have related products (woocommerce) as defined in the custom fields. I've just got a load of slugs and I dunno how I can query the array of slugs. Heres what ...
0
votes
0answers
24 views

extract shortcode_atts with multiple meta key and meta value

I am trying to extract( shortcode_atts( array( arry with multiple meta key and value in bellow snippet code you can see that i am extracting shortcode_ats with bellow code ...
0
votes
3answers
44 views

Sort the main query in subcategories/terms?

I've got a 'downloads' custom post, with his custom taxonomy. The taxonomy has 2 main terms. One of the 2, has 4 sub-terms. I'm currently using the wp templating system to get a standard wpquery of ...
0
votes
1answer
28 views

How to query Posts from a custom post type which contains a custom taxonomy?

I have the following: $queryResponse = new \WP_Query(array( 'post_type' => 'portfolio', 'tax_query' => array( array( 'taxonomy' => 'portfolio_date', ...
1
vote
1answer
18 views

How can i make WP_Query return post image and categories?

I have a sidebar widget that will display related posts based on a custom meta field. The query works, but its very wasteful. All i need is the post title, featured image and the categories of the ...
0
votes
1answer
19 views

Empty tax_query array returns an empty array

I would like to return all posts when the tax_query['terms'] is empty. $args = array( 'post_type' => 'product', 'posts_per_page' => 15, 'paged' => $paged, ...
0
votes
2answers
24 views

How to Insert data with wp cron

I am using wp_schedule_event for Insert data every 1 Minutes in a teble. But here is some confusion where i have to add code for Insert. Here is my code which add in functions.php in my theme. ...
0
votes
1answer
38 views

Get the post permalink within the loop but without additional DB query

I am looking to create a custom 'directory' page which will link to several thousands of posts. Because of the large number I am trying to limit the number of DB queries. I notice that to link to each ...
1
vote
1answer
36 views

Display posts from only one post form in custom query and exclude in main query

I am trying to first display four posts with post-format-aside (all assigned to current tag) and then display the "real" archive (exclude post-format-aside) for the specific tag. Right now I am using ...
0
votes
0answers
20 views

query.php - multiple is_category functions

Why does query.php have multiple is_category functions?! E.g. in my version of WordPress (4.x) I have in query.php: line 230: function is_category( $category = '' ) { line 4095: public function ...
0
votes
0answers
12 views

Debugging - is_category()

I'm trying to work out where WordPress decides if a URL is pointing to a Category or not. I've got to this function in query.php public function is_category( $category = '' ) { if ( ...
0
votes
0answers
23 views

Pagination not working Search posts

if ( have_posts() ) { while ( have_posts() ) { the_post(); global $post; //loop here } if(function_exists('wp_pagenavi')) { wp_pagenavi(); } } I have the following code in function ...
2
votes
1answer
36 views

Get taxonomy description based on variable

I'm trying to display a taxonomy description based on which taxonomy the page is set to display (set with a variable) As it is, I'm only seeing the first description, regardless of which category ...
0
votes
0answers
32 views

Breaking WP_Query loop into rows with variable width columns

I'd like to create a Boostrap grid of posts where sticky posts take 6 columns (.col-md-6) and normal posts take 3 columns (.col-md-3). Posts to be sorted dynamically. So in one row there might be ...
0
votes
1answer
18 views

Multiple loops without repeating content

I have a second loop on a page where I want to display posts from the same category as the present post but excluding the present post. I have a loop that displays all the posts from the same ...
0
votes
1answer
29 views

Pagination not working Category posts

I am using https://wordpress.org/plugins/wp-pagenavi/ pagination and because of certain reason I have "blog pages show at most" set to 100 and i can't reduce it. I have total 30 posts in a category. ...
0
votes
0answers
14 views

GUID to related post not in current language

I'm having problems with related posts and the link to them. I'm using the plugin Posts 2 Posts to create connections between posts. I also have three languages in wordpress website (french, ...
0
votes
1answer
59 views

Convert a WP Query into a simpler SQL query to fetch only COUNT of posts

I have this WP Query running for each row in my admin screen for a certain post type: $entry_args = array( 'meta_key' => 'wp_comp_entry_competition-id', ...
0
votes
0answers
13 views

WP_Query filtered by simple checkboxes

I'm trying to build a WP_Query with specific filters, i.e., checkboxes and radio buttons. The checkboxes will filter the meta-data linked with my custom post type. The meta-data is the location. And ...
0
votes
1answer
41 views

WP_Query with MetaQuery issue

I'm facing a rather strange issue when attempting to pass in four different meta_query values to my WP_Query. Find below an example of my WP_Query search. Please bear in mind, if I remove and test ...
0
votes
2answers
57 views

Pagination for custom loop on custom page template is not displaying anything

I have created a page where user can see his favourite post which has been bookmarked by him get_user_favorites($user_id); This function is responsible for returning me all the favourite posts ...
0
votes
1answer
17 views

meta_value timestamp older than now

In my wp_posts table I want to select the rows where post_type == event. I also want to a connection with wp_postmeta from the specific row. In my wp_postmeta table I want to do a where like this: ...
1
vote
1answer
25 views

Hide Post comments when displayed via WP_Query

I've written a shortcode which displays 'x' number of posts on the homepage of my site when I write [blog posts_per_page-"3"]. Here it is: function getBlogPosts($atts) { ...
2
votes
2answers
42 views

Query sticky posts with thumbnails

I need to display max 5 latest sticky posts that have a thumbnail. And I need to have accurate counting of the displayed posts. I've tried to exclude sticky posts without a thumbnail with meta_query, ...
1
vote
1answer
27 views

Show Sticky Post at the top but do not show again in the loop?

Regarding wordpress.org - sticky posts are displayed at the top but they also appear again in the loop. For the main loop on my homepage I want to display the sticky posts at the top BUT I don't ...
0
votes
1answer
36 views

WP_Query custom query showing only 10 posts on all pages

WP_Query custom query showing same only 10 posts on all pages when set to 5. Here is my code: Updated code: <?php global $wp_query; $paged = (get_query_var('page')) ? get_query_var('page') : 1; ...
0
votes
1answer
26 views

Display posts by tag

I'm trying to display a list of posts by tag within a post. I've cobbled together the following code which I wanted to use in a shortcode, but I'm getting nothing displayed… $args = array( 'tag' ...
0
votes
0answers
19 views

Get X posts for all post types on Taxonomy term archive

I'm working on a tabbed archive page for taxonomy terms. Ultimately, I want each tab to show the 10 most recent posts for an individual post type with a "see all" link at the bottom of the tab that ...
1
vote
0answers
67 views

meta_value_num not ordering all items

I am using meta_value_num to output a list of items in order by a custom field. The custom field value that is being passed is 1, 2 ,3 or 4. The order works for the first 7 items but after that they ...