Add_Custom_Fields_To_Search::cf_search_join( string $join )
Join posts and postmeta tables
On This Page
Description Description
See also See also
Parameters Parameters
- $join
-
(string) (Required) The JOIN clause of the query.
Return Return
(string)
Source Source
File: includes/class-add-custom-fields-to-search.php
public function cf_search_join( $join ) {
global $wpdb;
if ( ! is_search() || $this->is_media_library() ) {
return $join;
}
// join to search post meta values like year, make, model, trim, etc.
$join .= " LEFT JOIN $wpdb->postmeta searchmeta ON $wpdb->posts.ID = searchmeta.post_id ";
return $join;
}
Expand full source codeCollapse full source codeView on Github