Search Results
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 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
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 |
Refers to a hook in WordPress Core that can be used to alter the results returned by a WP_Query based database query.
0
votes
Accepted
Using a pre_get_posts filter to search for multiple strings on all meta values
Yes, I got it:
function custom_search_where( $where = '' ) {
global $wpdb;
if ( is_search() ) {
if ( isset($_GET['my-terms']) ) {
$count = count($_GET['my-terms']);
…
1
vote
2
answers
3k
views
Using a pre_get_posts filter to search for multiple strings on all meta values
Using a pre_get_posts filter to search a given string on all meta_values:
$query->set('meta_value', 'first string');
debug:
AND ( (CAST(wp_postmeta.meta_value AS CHAR) = 'first string') )
Works …
2
votes
Accepted
How to alter query order direction using $query->set('order', 'ASC'); inside a pre_get_posts...
Yes, I got it:
function custom_search_orderby($orderby) {
global $wpdb;
if ( is_search() ) {
if ( isset($_GET['order']) ) {
if ( $_GET['order'] == 'DESC' ) {
…
2
votes
1
answer
4k
views
How to alter query order direction using $query->set('order', 'ASC'); inside a pre_get_posts...
According to:
http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
Default order is DESC and default orderby is date.
In a custom plugin, plugin is applying the following …
20
votes
2
answers
66k
views
Theres a way to use $query->set('tax_query' in pre_get_posts filter?
Theres a way to use $query->set('tax_query', ...) in pre_get_posts filter? for example next code is not altering the query. Note that I'm building $taxonomies from and custom search.
function custom_ …