Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ static function ( $format ) {
* @param WP_REST_Request $request The REST API request.
*/
$args = apply_filters( "rest_{$this->post_type}_query", $args, $request );
$args = is_array( $args ) ? $args : array();
$query_args = $this->prepare_items_query( $args, $request );

$posts_query = new WP_Query();
Expand Down Expand Up @@ -1210,7 +1211,8 @@ public function delete_item( $request ) {
* @return array Items query arguments.
*/
protected function prepare_items_query( $prepared_args = array(), $request = null ) {
Comment thread
apermo marked this conversation as resolved.
$query_args = array();
$query_args = array();
$prepared_args = $prepared_args ?? array();

foreach ( $prepared_args as $key => $value ) {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ public function get_items( $request ) {

/** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */
$args = apply_filters( 'rest_revision_query', $args, $request );
$args = is_array( $args ) ? $args : array();
$query_args = $this->prepare_items_query( $args, $request );

$revisions_query = new WP_Query();
Expand Down Expand Up @@ -548,7 +549,8 @@ public function delete_item( $request ) {
* @return array Items query arguments.
*/
protected function prepare_items_query( $prepared_args = array(), $request = null ) {
$query_args = array();
$query_args = array();
$prepared_args = $prepared_args ?? array();

foreach ( $prepared_args as $key => $value ) {
/** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */
Expand Down
Loading