Include ACF on search and Yoast functions
Omschrijving
postmeta. ‘ ON ‘. $wpdb->posts . ‘.ID = ‘ . $wpdb->postmeta . ‘.post_id ‘;
}
return $join;
}
add_filter(‘posts_join’, ‘cf_search_join’ );
function cf_search_where( $where ) {
global $pagenow, $wpdb;
if ( is_search() ) {
$where = preg_replace(
“/(s*”.$wpdb->posts.”.post_titles+LIKEs*(‘[^’]+’)s*)/”,
“(“.$wpdb->posts.”.post_title LIKE $1) OR (“.$wpdb->postmeta.”.meta_value LIKE $1)”, $where );
}
return $where;
}
add_filter( ‘posts_where’, ‘cf_search_where’ );
function cf_search_distinct( $where ) {
global $wpdb;
if ( is_search() ) {
return “DISTINCT”;
}
return $where;
}
add_filter( ‘posts_distinct’, ‘cf_search_distinct’ );
Snippet
| Field | Value |
|---|---|
| Snippet Status | |
| Snippet Description | |
| Snippet Type Code | |
| Snippet URL | |
| Snippet Content | |
| Snippet Content CSS | |
| Snippet Content HTML | |
| Snippet Content JS | |
| Snippet Content PHP | |
| Particle Snippet in Software | |
| Particle Snippet in Boilerplate |
Relations
| Item | Type |
|---|
Pointing items
| Item | Type | Category | Tags |
|---|