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 |
A generic term referring to the process of retrieving information from a database.
7
votes
Accepted
hook to get (and change) the search string before processing
parse_query function wee that it uses a flag to signal to the whole class that, indeed, the query is a "search", not surprisingly, it looks for s inside the query:
if ( isset( $this->query['s'] ) ) { … The main function that uses it is:
/**
* Displays the contents of the search query variable. …
0
votes
Increase offset while looping
In every file that you run a query, you must add this code:
global $duplicated_posts;
$args = [
'post_type' => 'post',
'post__not_in' => $duplicated_posts
];
$query = new \WP_Query($args); … php
while( $query->have_posts() ) :
$query->the_post();
$duplicated_posts[] = get_the_ID(); //golden ticket
..code for each post goes here. …