bp_esc_sql_order( string $order = '' )

Sanitize an ‘order’ parameter for use in building SQL queries.


Description Description

Strings like ‘DESC’, ‘desc’, ‘ desc’ will be interpreted into ‘DESC’. Everything else becomes ‘ASC’.


Parameters Parameters

$order

(Optional) The 'order' string, as passed to the SQL constructor.

Default value: ''


Top ↑

Return Return

(string) The sanitized value 'DESC' or 'ASC'.


Top ↑

Source Source

File: bp-core/bp-core-functions.php

function bp_esc_sql_order( $order = '' ) {
	$order = strtoupper( trim( $order ) );
	return 'DESC' === $order ? 'DESC' : 'ASC';
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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