Filters the JOIN clause of the query.
Parameters
Source
$join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) );
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
| CARVIEW |
Filters the JOIN clause of the query.
When you use the wp_query object to run a query, not all tables are queried by default. For example, a query on the blog archive will only query the posts table. If you wanted to display posts that have specific meta value you will have to alter the wp_query object to include the required meta key.
$join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) );
| Used by | Description |
|---|---|
WP_Query::get_posts()wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
Example migrated from Codex:
To include the required tables in the query use the
posts_joinfilter.The below example adds a meta field for use in displaying search results.
And then the specific search: