"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
6 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
24 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
21 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
2answers
32 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
23 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
17 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
16 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
20 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
29 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
33 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
19 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
33 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
27 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
17 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
26 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
17 views

Query posts by category and tag_id [on hold]

I have a query which looks like this: <?php $args = array( 'post_type'=> 'user', 'showposts'=> -1 ); $users = new WP_Query($args); echo '<pre>' ...
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
57 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
9 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
54 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
39 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
21 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
32 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
23 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
17 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
65 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 ...
0
votes
2answers
73 views

Only display post if published in last 24 hours?

All I'm trying to do here is a simple custom loop using WP_Query to display posts if they are published in the last 24 hours; otherwise, a message appears telling the user to check back soon for fresh ...
0
votes
1answer
28 views

wp_query with custom post type only returning last posted

i am using wp_query to get posts for a custom post type but it is only returning the most recently posted item. This is both in the returned object and within the loop: $wp_query = new ...
0
votes
1answer
36 views

Custom query with post_class filter using current_post not working

I have a new WP_Query on my archive page. I also have a post_class filter conditionally adding a class of first so I can display them in rows of 3 reliably. This is the post_class filter function ...
0
votes
0answers
21 views

How to achieve an elegant way when using ajax to get data for a table in WordPress?

I'm working on the update for a website which wasn't originally developed by me. The task is to have a table on a main page and, if you move a slider with value on it (100, 200, ... 1000), the table ...
0
votes
1answer
30 views

Does putting queries within loops cause an issue on Wordpress?

If I include a new wp_query within another query's loop (e.g. putting even a very simple query, like the ones from the codex example on a single page template) the page loads as expected, but the ...
0
votes
1answer
21 views

Trying to list out child pages with WP_Query

I'm trying to list out all the child pages of a custom page I've made. In my custom page, I'm doing this to list out the pages: <?php get_header(); ?> <?php $subpages = new WP_Query( ...
0
votes
2answers
36 views

WP_Query Posts by Metadata from Option Tree

I am doing a WP_Query trying to filter out the posts by Metadata. $args = array( 'ignore_sticky_posts'=> 1, 'post_type' => 'post_projects', 'post_status' => 'publish', ...
0
votes
3answers
29 views

Stylesheet won't load even when linked

I don't know what I'm doing wrong here. I created a page with accordians, the jquery script loads just fine but when I link the CSS stylesheet, no CSS shows up. It is not an external stylesheet, I ...
3
votes
1answer
80 views

Use REGEXP in WP_Query meta_query key

I know I can use REGEXP in WP_Query like this: $query = new WP_Query(array( 'posts_per_page' => -1, 'post_status' => 'publish', 'meta_query' => array( array( ...
2
votes
1answer
26 views

How do I create an archive page for standard posts?

I've been tasked with creating a portfolio website for a client who also wants a blog. What I've Done Thus Far: I’ve created a custom post type to separate the portfolio work from the blog posts and ...
1
vote
1answer
18 views

Not getting metavalue

I want to get meta value through meta key. Here is my code: $sqlMonth = mysql_fetch_array(mysql_query("SELECT meta_value FROM wp_usermeta WHERE user_id = " . $user_ID . " AND meta_key = 'month'")); ...
0
votes
0answers
31 views

WP query with bootstrap carousel

Under this jsfiddle you can see typical bootstrap carousel: http://jsfiddle.net/juddlyon/Q2TYv/10/ And its working properly. But what i wanted to achieve is to: - have carousel which displays same ...
0
votes
1answer
31 views

Using Cookie Data For WP_Query Loop

I'm trying to retrieve data set in a cookie and use this to run a query. I've set the cookie in functions.php like so; add_action( 'init', 'resultsCookie' ); function resultsCookie() { ...
0
votes
0answers
21 views

Saving Query Data & Using On Subsequent Pages

I have a PHP form that uses GET to send vars to a URL and return specific products in WooCommerce. Within the loop, I already have a piece of code to collect each product ID result. What I now need ...
0
votes
1answer
51 views

Mathematical operations on custom field values? (updated)

I'm attempting to write a function, run by a cron schedule at midnight every night, that will subtract 1 from the integer value of a custom field. It will function basically as a countdown timer for ...
0
votes
1answer
33 views

Filter user list that meta_value is empty

I am trying to get all users that meta value is empty so i tried many variations and cant get the list of all user that birthday field is empty (not set). ...
0
votes
1answer
47 views

Sort users by “birthday” using WP_User_Query

I have created user meta that holds user birthday (birthday). birthday is date field. Now i am trying to figure how to sort (get) all users that have birthday based on specific month. I have ...
0
votes
0answers
39 views

Ultimate Wordpress Query Search Filter plugin Results page id?

So, I am a Wordpress Novice(not even a Beginner) and I just started using Wordpress around two days ago.It seems I am already stuck on a problem. I am using a plugin called Ultimate Wordpress Query ...
0
votes
1answer
43 views

Get all remaining posts after a particular post id

We all know and its easy to get posts using WP_Query. We can filter, orderby etc. I am in a situation, where I would like to get all remaining posts after a post id, say 100. So what I need is to get ...