LLMS_Abstract_Query::sanitize_sort( $sort )
Removes any invalid sort fields before preparing a query.
Return Return
(void)
Source Source
File: includes/abstracts/llms-abstract-query.php
protected function sanitize_sort( $sort ) { $allowed_fields = $this->get_allowed_sort_fields(); if ( empty( $allowed_fields ) ) { return $sort; } foreach ( (array) $sort as $orderby => $order ) { if ( ! in_array( $orderby, $allowed_fields, true ) || ! in_array( $order, array( 'ASC', 'DESC' ), true ) ) { unset( $sort[ $orderby ] ); } } return $sort; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
6.0.0 | Moved from LLMS_Database_Query . Use get_allowed_sort_fields() . |
3.34.0 | Introduced. |