Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions includes/rest-api/Version1/class-listings-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -1489,14 +1489,29 @@ public function get_collection_params() {
}

protected function get_orderby_possibles() {
return array(
'id' => 'ID',
'include' => 'include',
'title' => 'title',
'date' => 'date',
// 'rating' => 'rating',
'popular' => 'popular',
'price' => 'price',
/**
* Filter the available "orderby" options used in the listings API schema and controller.
*
* This hook allows developers to modify or extend the enum values that define the orderby options
* for listing queries in the Directorist REST API. These options control how listings are sorted
* when fetched via API (e.g., by date, title, rating, etc.).
*
* @param array $orderby_options Array of allowed orderby values.
*
* @return array Modified list of orderby options.
*/
return apply_filter(
'directorist_listings_controller_orderby_options',
array(
'id' => 'ID',
'include' => 'include',
'title' => 'title',
'date' => 'date',
// 'rating' => 'rating',
'popular' => 'popular',
'price' => 'price',
'rand' => 'rand',
)
);
}

Expand Down