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

tag__in does not return posts

I want to get a custom post type posts with the same tags. Here's what I'm trying: $tags = get_the_terms( $post->ID, 'item-tags' ); //returns tags array correctly if ($tags) { $tag_ids = ...
0
votes
1answer
51 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 ...
1
vote
1answer
688 views

Multiple keyword search

I have a custom search where I want to enter a keyword or phrase into the search box, and then by pressing enter it adds it to a 'search storage' (already coded, see below). Asume I have 3 posts, one ...
0
votes
0answers
16 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

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 ...
2
votes
1answer
45 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
30 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 ...
0
votes
0answers
47 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
24 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
40 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
2answers
73 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
0answers
16 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
3answers
4k views

Wp_query order by multiple custom fields?

I am learning WP_query and recently ran into a problem. I need to do a query where i first filter trough one or more custom fields, which works great thanks to meta_query. However, i also need it to ...
0
votes
1answer
76 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
22 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
50 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
1answer
40 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
20 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
29 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
47 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
38 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 ...
4
votes
2answers
936 views

compare meta_query in get_posts arguments

I like to exclude certain posts with a custom field. So if my_custom_field_ignore isset AND 1 ignore this post. If it's not set include it. This is what I have $args = array( 'post_type' ...
0
votes
1answer
32 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
2answers
882 views

Post Type => Any conundrum

I have a number of regular posts and pages in a regular category called "Featured". I have also installed a plugin called "Event Organizer" that creates its own custom post type called "Event" and has ...
0
votes
0answers
22 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
2answers
1k views

search query within custom taxonomy term, post title and meta field

I want to create a search that does: Search within my custom taxonomy - custom-tags search the post title search select meta field ?? dont know search with custom post type - easy part I looked ...
0
votes
2answers
106 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 ...
1
vote
0answers
70 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
1answer
37 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 ...
2
votes
1answer
37 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 ...
0
votes
3answers
2k views

Sort posts by category name and title

Trying to figure out how I can output my posts based on category title (a–z) and secondly, the title of the posts within the category: A CATEGORY – A post beginning with a – Because I want to be ...
0
votes
1answer
50 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
1answer
31 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
0answers
32 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 ...
1
vote
1answer
649 views

Querying A Post That Includes Two Taxonomies Using JSON Rest API

I'm using the JSON Rest API plugin (https://wordpress.org/plugins/json-rest-api/). I have two custom taxonomies with one term each: Inner Part Categories Eye Symptoms Categories (Man) Broken Bone ...
0
votes
1answer
31 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
47 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
1answer
29 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
3answers
30 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
128 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
2answers
81 views

How to show in search results posts with a particular tag in a particular category?

As the home page of my blog I've a static page. There I want to show the navigation of the site. Category1 Sub-Category1 tag1, tag2, tag3 Category1 Sub-Category2 tag1, tag2, tag3 ...
0
votes
3answers
145 views

Order By Multiple Meta Fields

I have two custom fields: meta_key1 is boolean (0 or 1). meta_key2 is a date value - 20150623 for example. Not all meta_key2 fields have an explicit value. It looks like their being treated as an ...
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
40 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
63 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 ...
2
votes
1answer
2k views

order by numeric value for meta value

I have read countless posts on ordering data by numeric value ( as opposed to string - it i have a numeric meta value and it gets ordered like this 1 11 12 2 233 etc as opposed to the way i want it I ...
0
votes
1answer
36 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
22 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
43 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
71 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 ...