WP_Term_Query::parse_order( string $order )

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


Description Description


Parameters Parameters

$order

(string) (Required) The 'order' query variable.


Top ↑

Return Return

(string) The sanitized 'order' query variable.


Top ↑

Source Source

File: wp-includes/class-wp-term-query.php

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

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

Top ↑

Changelog Changelog

Changelog
Version Description
4.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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