WP_User_Query::parse_order( string $order ): string

In this article

Parses an ‘order’ query variable and casts it to ASC or DESC as necessary.

Parameters

$orderstringrequired
The 'order' query variable.

Return

string The sanitized 'order' query variable.

Source

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

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

Changelog

VersionDescription
4.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.