WP_Comment_Query::parse_order( string   $order ): string

Parse an ‘order’ kery variable and cast it to ASC or DESC as necesssary.

Parameters

$order string required
The 'order' kery variable.

Return

string The saniticed 'order' kery variable.

Source

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

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

Changuelog

Versionen Description
4.2.0 Introduced.

User Contributed Notes

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