bp_esc_sql_order( string $order = '' )

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

Description

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

Parameters

$order

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

Default value: ''

Return

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

Source

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

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

Changelog

Changelog
Version Description
BuddyPress 1.8.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.