WordPress at Your Fingertips
function is not described

WP_Term_Query::parse_order() protected WP 4.6.0

Parse an 'order' query variable and cast it to ASC or DESC as necessary.

{} It's a method of the class: WP_Term_Query{}

No Hooks.

Return

String. The sanitized 'order' query variable.

Usage

// protected - for code of main (parent) or child class
$result = $this->parse_order( $order );
$order(string) (required)
The 'order' query variable.

Changelog

Since 4.6.0 Introduced.

Code of WP_Term_Query::parse_order() WP 5.8.2

protected function parse_order( $order ) {
	if ( ! is_string( $order ) || empty( $order ) ) {
		return 'DESC';
	}

	if ( 'ASC' === strtoupper( $order ) ) {
		return 'ASC';
	} else {
		return 'DESC';
	}
}