Used By
Used By | Description |
---|---|
wp-includes/class-wp-network-query.php: WP_Network_Query::get_network_ids() | Used internally to get a list of network IDs matching the query vars. |
Parses and sanitizes ‘orderby’ keys passed to the network query.
(string) (Required) Alias for the field to order by.
(string|false) Value to used in the ORDER clause. False otherwise.
File: wp-includes/class-wp-network-query.php
protected function parse_orderby( $orderby ) { global $wpdb; $allowed_keys = array( 'id', 'domain', 'path', ); $parsed = false; if ( 'network__in' === $orderby ) { $network__in = implode( ',', array_map( 'absint', $this->query_vars['network__in'] ) ); $parsed = "FIELD( {$wpdb->site}.id, $network__in )"; } elseif ( 'domain_length' === $orderby || 'path_length' === $orderby ) { $field = substr( $orderby, 0, -7 ); $parsed = "CHAR_LENGTH($wpdb->site.$field)"; } elseif ( in_array( $orderby, $allowed_keys, true ) ) { $parsed = "$wpdb->site.$orderby"; } return $parsed; }
Version | Description |
---|---|
4.6.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_network_query/parse_orderby