Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 847

"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 global variable that holds the main query object prepared by WordPress based on a given request.

1
vote
get_users_of_blog() is indeed deprecated and has SQL query hardcoded to sort by ID. You need to use modern get_users() function. It supports many arguments, including multiple ways to sort.
answered Sep 11 '14 by Rarst
5
votes
That implode() is probably what breaks things: $access_ids = '158, 162, 145, 269'; $array = array($access_ids); //wrong var_dump( $array ); // array // 0 => string '158, 162, 145, 269' (length=18) …
answered Feb 6 '12 by Rarst
2
votes
Which order you want to achieve? Chronological? Alphabetical? In any case see Order & Orderby Parameters in Codex for available arguments.
answered Jan 24 '11 by Rarst
1
vote
You are wrapping your parameters string in unnecessary layer of quotes: $parameters = "'category__in=1'"; — wrong $parameters = 'category__in=1'; — right It is usually preferable to use arrays for …
answered Jun 4 '15 by Rarst
2
votes
WP_Query can repeatedly loop through the retrieved posts multiple times, but it was never meant to query them repeatedly/iteratively. You can just do $query->query($args) again, but there is little p …
answered Jul 27 '17 by Rarst
0
votes
Your query seem to fall outside of realm what's "normal" for WP APIs to do. There are two general approaches to it: Keep it completely in SQL. If you can figure out how to adapt it to WP's schema y …
answered Aug 16 '16 by Rarst
14
votes
3answers
I have multiple stage process that integrates complex faceting into WP queries. Problem is - the deeper I get the more fuzzy I become on how it is supposed to work and I could use a guideline rather t …
asked May 29 '12 by Rarst
1
vote
This is definitely not within realm of native orderby parameters in query. They are limited to an order by individual meta fields and have no ways to implement aggregate of them. You would have to ei …
answered May 16 '16 by Rarst
1
vote
That would be something like: query_posts( array( 'cat' => '16', 'order' => 'ASC', 'orderby' => 'meta_value', 'meta_key' => 'ti …
answered Nov 7 '11 by Rarst
11
votes
It should be: $newsposts = new WP_Query('cat=restaurant&posts_per_page=7'); Another way to write it (helps readability with larger queries) would be: $newsposts = new WP_Query(array( 'cat' => …
answered Apr 4 '11 by Rarst
2
votes
Such condition is impossible to express in current WP API. You can use search for title/content matches and meta query for LIKE matches on post meta, but there is no way to establish OR relationship b …
answered Jun 7 '16 by Rarst
1
vote
If you can formulate problematic part of your request as WP query you can run it and look at $wpdb->last_query to see generated SQL. This is usually easiest way to have a starting point and something …
answered Oct 12 '11 by Rarst
2
votes
This is not trivial, because "home,category and search" are logically determined while main query churns through stuff. I am pretty sure I read this is possible, but that was in context of syndicating …
answered Sep 28 '12 by Rarst
1
vote
Ajax handler runs in completely separate instance of WordPress, it has no access to global variable from your pages and such. Basically there is nothing to rewind here, you need to pass those environ …
answered Jun 22 '11 by Rarst
0
votes
This is more in the realm of basic PHP, which is often overlooked with WP's loop "magic". $values = array(); while( have_posts() ) : the_post(); if ( in_array( $something, $values ) { c …
answered Jul 1 '14 by Rarst

15 30 50 per page