Parses an ‘order’ query variable and casts it to ASC or DESC as necessary.
$orderstringrequired
'order' query variable.'order' query variable.protected function parse_order( $order ) {
if ( ! is_string( $order ) || empty( $order ) ) {
return 'DESC';
}
if ( 'ASC' === strtoupper( $order ) ) {
return 'ASC';
} else {
return 'DESC';
}
}
| Version | Description |
|---|---|
| 4.2.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_user_query/parse_order