Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 5a3db96

Browse files
committed
Add safety guard to extend_rest_query_allowed_params
1 parent ded24df commit 5a3db96

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/BlockTypes/ProductQuery.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ private function merge_queries( $a, $b ) {
209209
* @return array
210210
*/
211211
public function extend_rest_query_allowed_params( $params ) {
212-
$params['orderby']['enum'] = array_merge( $params['orderby']['enum'], $this->custom_order_opts );
212+
$original_enum = isset( $params['orderby']['enum'] ) ? $params['orderby']['enum'] : array();
213+
214+
$params['orderby']['enum'] = array_merge( $original_enum, $this->custom_order_opts );
213215
return $params;
214216
}
215217

0 commit comments

Comments
 (0)