Add clause to `CustomMetaDataStore::get_meta_keys` query to exclude empty order meta keys (#46476)
* Add clause to query in `CustomMetaDataStore::get_meta_keys` to exclude metas where the key is ''. * Addressing linter error. Removed unnecessary prepare.
This commit is contained in:
parent
c6048b5c49
commit
63443b502d
|
@ -0,0 +1,5 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: tweak
|
||||||
|
Comment: Added clause to query in CustomMetaDataStore::get_meta_keys to exclude metas where the key is ''.
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,9 @@ abstract class CustomMetaDataStore {
|
||||||
$query = "SELECT DISTINCT meta_key FROM {$db_info['table']} ";
|
$query = "SELECT DISTINCT meta_key FROM {$db_info['table']} ";
|
||||||
|
|
||||||
if ( ! $include_private ) {
|
if ( ! $include_private ) {
|
||||||
$query .= $wpdb->prepare( 'WHERE meta_key NOT LIKE %s ', $wpdb->esc_like( '_' ) . '%' );
|
$query .= $wpdb->prepare( 'WHERE meta_key != \'\' AND meta_key NOT LIKE %s ', $wpdb->esc_like( '_' ) . '%' );
|
||||||
|
} else {
|
||||||
|
$query .= "WHERE meta_key != '' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC';
|
$order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? $order : 'ASC';
|
||||||
|
|
Loading…
Reference in New Issue