Used By
Used By | Description |
---|---|
wp-includes/class-wp-meta-query.php: WP_Meta_Query::get_sql_for_clause() | Generate SQL JOIN and WHERE clauses for a first-order query clause. |
Return the appropriate alias for the given meta type if applicable.
(string) (Optional) MySQL type to cast meta_value.
Default value: ''
(string) MySQL type.
File: wp-includes/class-wp-meta-query.php
public function get_cast_for_type( $type = '' ) { if ( empty( $type ) ) { return 'CHAR'; } $meta_type = strtoupper( $type ); if ( ! preg_match( '/^(?:BINARY|CHAR|DATE|DATETIME|SIGNED|UNSIGNED|TIME|NUMERIC(?:\(\d+(?:,\s?\d+)?\))?|DECIMAL(?:\(\d+(?:,\s?\d+)?\))?)$/', $meta_type ) ) { return 'CHAR'; } if ( 'NUMERIC' === $meta_type ) { $meta_type = 'SIGNED'; } return $meta_type; }
Version | Description |
---|---|
3.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_meta_query/get_cast_for_type