Usage
PHP
nebula()->fuzzy_posts_where($where)
Parameters
$where
(Required) (String) The custom where clause
Default: None
Parameter Notes
Use _%_ in the where string for the fuzzy logic.
Examples
PHP
'key' => 'dates_%_start_date'
Source File
Located in /libs/Utilities/Utilities.php on line 1088.
1 Hook
Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.
Filters
"pre_nebula_fuzzy_posts_where"Need a new filter hook? Request one here.
Actions
This function has no action hooks available. Request one?
PHP
public function fuzzy_posts_where($where){
$override = apply_filters('pre_nebula_fuzzy_posts_where', null, $where);
if ( isset($override) ){return $override;}
global $wpdb;
if ( str_contains($wpdb->remove_placeholder_escape($where), '_%_') ){
$where = preg_replace(
"/meta_key = ([\'\"])(.+)_%_/",
"meta_key LIKE $1$2_%_",
$wpdb->remove_placeholder_escape($where)
);
}
return $where;
}
Override
To override this PHP function, use this hook in your child theme or plugin ("my_custom" can be changed):
PHP
add_filter('pre_nebula_fuzzy_posts_where', 'my_custom_fuzzy_posts_where', 10, 2); //The last integer must be 1 more than the actual parameters
function my_custom_fuzzy_posts_where($null, $where){ //$null is required, but can be ignored
//Write your own code here
return true; //Return true to prevent the original function from running afterwords
}
You can completely disable this PHP function with a single line actions:
PHP
add_filter('pre_nebula_fuzzy_posts_where', '__return_false');