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.
1
vote
Accepted
Getting post data from private page
You need to call wp_reset_postdata() when you're done so that code that runs after your loop has the current post and not the last post in your query. … Here's what that query might look like:
$the_query = new WP_Query( array(
'id' => '1457'
'post_type' => 'page',
'post_status' => 'private'
) );
if ( $the_query->have_posts() ) {
while( …
1
vote
Help with MySQL to $WPDB query
http://codex.wordpress.org/Class_Reference/wpdb
query returns the number of affected rows. Instead use get_results, which returns all the rows specified by the query. …
0
votes
Accepted
Access Tables with number prefix
When in multisite, the wpdb prefix is always the prefix required to access the tables for the current site. This includes the site ID
so this should work:
$wpdb->get_results($wpdb->prepare("SELECT * …
1
vote
Setting get_queried_object
= reset( $tax_query_in_and );
if ( 'term_id' == $query['field'] )
$term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
elseif ( $query['terms'] ) … $term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
if ( ! …
2
votes
How to get one result using wpdb class?
You've made no attempt to check for errors, e.g. $result may be false, also your code would fail if there was more than one result returned.
So instead of using a custom table, and reinventing the wh …
0
votes
Modify behaviour of "s" parameter in wp_query
This works the same way Google etc work, to search for an exact phrase, wrap it in quotes
e.g. online books vs "online books"
0
votes
Set WP_query 'order' option by another tables value
You can't directly, instead you'll need to figure that out yourself then provide the sort order manually to WP_Query and specify post__in as the orderby value
0
votes
Accepted
display text generated via custom get query string
foo=bar then run this code:
query_post('s=test');
echo get_query_var( 'foo' );
It will not print bar, because the current main query does not contain a foo query variable. … The main query has already ran, it's already fetched your page, and already decided on the template to load. …
1
vote
Accepted
Filter custom post types in archive
The problem is that you're using term IDs in your URL, but that is incorrect.
Use the term slug instead.
For example, lets say we have a mytax term named helloworld with the term ID 1:
example.com/cp …
1
vote
How to use parse_query() to add an additional filter based on content to page search?
There is only one parameter that will filter your results to posts that contain a value in the content, s aka search, but doing so would break the search box. Unless you write code that on save update …
2
votes
Accepted
Why does $_GET return values but get_query_var does not?
Query variables and GET values are not the same thing.
Query variables usually get their values either from query objects, e.g. the parameters and arguments passed to new WP_Query or get_posts. … Query variables, or query arguments can be changed but you must do this before the query runs. …
2
votes
Exclude post from wp_query based on custom field boolean
$query->is_home() ) {
return; // we only want the homepage
}
$query->set( 'filters', 'homepage-show' );
}
And you have a super useful way to highlight things! … Then you could add a featured term and query for it like this:
$query = new WP_Query( [
'filters' => 'featured'
] );
// followed by a standard post loop... …
1
vote
Accepted
How to make async query in wordpress?
Is any way to make asynchronius query to wordpress, where i can use wordpress functions? …
2
votes
How to display posts under a specific subcategory of a given category
If you pass anything using this GET variable, Wordpress will modify the query accordingly assuming its a category. This is bad news. …
2
votes
Accepted
Get the most popular terms for a custom post type
That way when you want to do your list, you query the second hidden taxonomy, which acts as a cache of sorts. …