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

post_per_page ignored in WP_Query

I have a custom post type named 'album' and I added two custom fields 'release_date' and 'release_date_us' with the ACF plugin. I'm trying to display the latest albums based in a widget area. The ...
0
votes
0answers
6 views

Filter get_projects_category();

Is it possible to amend the <?php get_projects_category(); ?> to only get projects from specific categories? The previous code is populating a menu with category links, and I only want certain ...
0
votes
2answers
49 views

Show single posts date, in a page of posts

In a page of posts, how do I show their date, instead of the page date? I have no php knowledge. Let's say I want to show the single posts date here, instead to the single posts title. <?php ...
0
votes
1answer
28 views

Get posts with multiple categories

How to get just the common posts of 2 different categories? consider this category tree: posttype -news -arrangement --course --competetion --other region -region1 -region2 -region3 Now I want to ...
0
votes
1answer
58 views

category__in not working on custom post type

Can't get my WP_Query loop to work, cannot figure out why category__in won't work. Just want to pull certain categories FROM my custom post type $args = array( 'post_type' => 'bbt', ...
0
votes
2answers
42 views

Change query from cat id to slug or name?

I'm using the following query to fetch posts in a category (10). I would like to change this code to use the category slug or name instead of the id number as this often changes when I move sites ...
0
votes
2answers
1k views

Display featured posts for a custom post type by taxonomy

Ok, the quick explanation: I'm using a custom post type, 'lakes'. And, using custom taxonomies to organize them. They are: state, watertype and county. I've created a 'page' for each state that ...
0
votes
0answers
70 views

How can get Custom Posts Sort by Hour

I need to show posts from 00:00:00 AM to 00:00:00 PM, and orderby day too. How can i do that? Look the following code: $programasQuery = new WP_Query(array( "post_type" ...
1
vote
1answer
58 views

Query wp_usermeta alongside wp_users

I want to use the WordPress query functions and no external plugins for the task. Here is what I have so far: add_filter('user_search_columns', 'user_search_columns_bd' , 10, 3); function ...
2
votes
2answers
2k views

Get posts by meta data OR title

I have a working query that calls all my posts that have a certain meta value for one of two meta keys: $term = $_GET['term']; $args = array( 'post_type' => 'some_cpt_name', 'meta_query' ...
4
votes
1answer
291 views

Enforcing canonical URLs with multiple custom post types

I'm working on a project with several custom post types, where one of the post types is naturally (but not actually in the WordPress sense) the 'parent' of the others. For example, say I have a ...
0
votes
1answer
434 views

Last post ordered by publish date using WP_Query on front page

I'm joining together few websites into one and I created appropriate posts and changed their post_date (publish date) to the original time of post. However (even if I list more than 1 post) the ...
0
votes
2answers
60 views

get_posts query matches too many results

I have a query inside a function that is returning matches that i don't want, for example when the $id=116 it is also returning results where the meta_key 'funds_id' is 11687. public function ...
0
votes
2answers
116 views

Get post ids from WP_Query?

Is there a way I can retrieve an array of post ids queried from the following: $latest = new WP_Query( array ( 'orderby' => 'rand', 'posts_per_page' => 3 )); if ( ...
0
votes
1answer
381 views

Display count number of posts with the same specific meta_key meta_value

I want to display a list of posts ordered by a specific meta_key. My posts have the following custom fields: author_lastname and author_firstname. So far, it works good. The posts are displayed ...
3
votes
1answer
101 views

Order by meta_value_num DESC and meta_value ASC on WP 4.0

I have created a custom post type that I want to order by custom-field-1, which is boolean so its value is either 1 or 0, in DESC order (1 to 0) custom-field-2, which contains text and is supposed ...
0
votes
0answers
33 views

$wp->query_vars redirection giving me error

I am using plugin which is working based on short code.And I want to redirect to one template for single location. And I have given href like this to the plugin- ?wpsl-id= So basically what I have ...
0
votes
0answers
30 views

Orderby Meta Value and Query from Meta Query

The following query is returning blank with no errors and I'm not sure why. Query Arguments: $args = array( 'post_type' => 'games' , 'posts_per_page'=> -1, 'meta_query' ...
0
votes
2answers
2k views

Simplest way to query with blog_id?

What is the simplest way to query posts using blog_id? I have a post type called video that holds, not surprisingly, multiple embedded videos. Each post has a different video. I would like to ...
0
votes
0answers
26 views

Can I use pretty URLs for paramaters without query_vars?

I have a plugin that retrieves data from custom non-WordPress tables. I'd like to be able to add pretty URLs to retrieve the data, but as far as I can tell, if I use the add_rewrite_rule and ...
0
votes
2answers
49 views

Combine privileged users array with my current query

I have a custom page template with the following query. Isotope filers my categories and all this works fine. I want now to make this page only viewable by a few specific, currently logged in ...
0
votes
0answers
23 views

query wordpress page template

I'm making a one page template and have a menu set up to control the pages that are being displayed. I want to query the pages from the menu, however include the template with all the page data (php ...
0
votes
0answers
20 views

Post returns wrong result when adding Arabic parameter to WP_Query

I have a WP_Query which works perfectly when I use an English parameter like this: $the_query = new WP_Query( 'tag=english param'); but when I add this: $the_query = new WP_Query( 'tag=arabic ...
0
votes
2answers
62 views

Efficient way to update multiple post meta

I have managed to update post meta using update_post_meta(). However, the more posts I have, the more time it takes. I would like to minimize the time it takes to process say about 400 posts (although ...
0
votes
2answers
44 views

Pagination not working in secondary query

I'm trying to fix a theme which has the following setup: on each page the user can select to list posts instead of the page content. The problem is that the pagination doesn't work on this page even ...
0
votes
2answers
129 views

How to get post id of static front page?

I'm trying to use the front page as a default of sorts for featured images (if no featured image is set, I want to use the front page's, for example) But I'm having trouble finding out how to get the ...
0
votes
0answers
54 views

Show sticky post before other WP_Query

$recent_posts = new WP_Query( array('posts_per_page' => $blog_num_posts, 'paged' => $paged, 'post_type' => 'post', 'post_status' ...
0
votes
0answers
40 views

Sort order not working properly with meta_query

I have a template that pulls a custom post type for properties and sorts them by state. The script works properly until you add in a meta_query for the agent. It pulls the correct properties, but it ...
6
votes
1answer
16k views

WP_Query - Order results by meta value

I've checked around and haven't seen an answer which works as of yet. I have a WP_Query with the following arguements: $args = array( 'post_status' => 'publish', 'post_type' => ...
0
votes
2answers
50 views

Custom taxonomy wp_query woes.

Here's a brief outline of the set-up: "The Art" CPT is where all the art and art descriptions are uploaded. In this CPT you can choose the category (custom taxonomy) of the art--painting, jewelry, ...
1
vote
3answers
5k views

Exclude post ID from wp_query

How can I exclude one specific post from a WP_Query query? (For example, show all posts apart from a post with the ID 278) I've tried the post__not_in argument but it just removes all posts.. Any ...
0
votes
1answer
45 views

ajax wp_query conditional tags not working

I'm trying to ajax wp_query, I got success getting posts for home page with the following code. Then I added conditional tags to modify the query for the other pages like Category page the problem ...
0
votes
1answer
38 views

Sort by custom field that is an array?

is it possible to sort posts inside a query based on post value that is in an array - but using the last element of the array? The code looks something like: <?php $mostsharedposts= new ...
1
vote
1answer
39 views

Date query not inclusive despite parameter being true

I've set up a small test query to get some posts from October 1 to October 10. I published a post today ( October 10 ) and with the date query parameter of include set to true, I would have expected ...
5
votes
1answer
178 views

How to Compare Two Meta Fields

Consider two meta fields balance and monthly_price. How you would get all posts that has balance < monthly_price Thinking of creating meta query but our both fields are arbitrary or do not have ...
0
votes
0answers
16 views

Do not count menu items in posts_per_page

Custom type posts are added to query for category page: function test__pre_get_posts( $query ) { if( !is_home() ) { if( is_main_query() || is_category() ) { $query->set( 'post_type', ...
0
votes
1answer
33 views

Comparing 2 Decimal Numbers from custom fields and displaying posts

This is really confusing me. Hopefully you can help me. What i want to do, is search for a number and display anything that is either minus 1 or plus one of the search result. The numbers that it will ...
0
votes
0answers
44 views

how to show a tooltip include of thumbnail and excerpt when hovering a post link in other post?

Is there any way to call thumbnail and excerpt for link of post in another wordpress post? For example when i hover a post link in other posts, it shows a tooltip include of thumbnail, excerpt. Like ...
0
votes
0answers
52 views

WP Query to order posts by multiple meta fields

This question might have an answer already in the forums, however I still wanted to ask it as this is a different more complicated version of the problem. The story: We have 2 meta fields for ...
0
votes
0answers
19 views

Inline Ajax call after term is appended with a @ or # etc. displayed in div

Basically what I would like to know is how to do the following: I have TinyMCE Advanced enabled. I would like for my users to be able to tag content with different special characters (each refer to a ...
0
votes
0answers
44 views

Nested get_template_part / WP_Query – How should I do this?

I'm running a loop that runs a certain get_template_part, and that template file itself should then run another get_template_part, with the purpose to get some posts, is this even possible? At the ...
1
vote
3answers
477 views

WP_Query orderby breaks when using AJAX?

I'm running in to a bit of a problem. I have a function called get_press(), it retrieves newest press items. It is inside of a plugin: class EWPress { function __construct() { ...
0
votes
1answer
167 views

Display custom field meta outside loop, site wide

I've created a custom field ("breaking") with the goal that whenever one post has this field present, it will display the value in the header throughout the site (that is, all posts, pages, archives, ...
0
votes
1answer
29 views

Custom query to order by multiple taxonomies

I got this website from a customer to fix some bugs. They are a car dealership. The previous developer created a custom post type (vehicle) and there are two taxonomies: make and model. (they are not ...
0
votes
1answer
42 views

List ALL posts within last week from current category on category page

My category template shows 5 (full content) posts per page and I want to add a list of ALL the posts during the past week for that category to the top of the page as a quick overview. So the first ...
0
votes
1answer
57 views

Pagination in custom query in a category page

In a category (I create category-123.php), I'd like to create a new custom query in order to show all the posts that have right parameters (custom fields). <?php $today = date("Ymd"); $paged = ...
0
votes
0answers
61 views

WP_Query on “property” in the options table

I'm quite new to WP and I hope this question isn't seen as too specific. It's not entirely bound to my little "pre story". I'd really like an answer to this question for future cases as well. I get ...
3
votes
3answers
2k views

querying with custom meta field with meta_query

How do we get posts where the meta key does not exist in a post. I have created a meta_key video. and i want to be able to get some posts with WP_Query where custom field video does not exist or is ...
0
votes
0answers
64 views

WP_Query Order by Specific Post ID First

I'm creating a website where I have a need to show a set of posts from a custom loop but I need to display a specific post first. This post will be dynamically specified in the URI by a $_GET ...
0
votes
1answer
106 views

Removing posts from the returned wp_query. Cannot use object of type WP_Query as array

My end goal is to perform 3 custom field filters on a sets of filters on a WP_Query. The difficulty arises as I need to use both AND/OR relations between the 3 filters: field1 = A AND field2 = ...