REST CRUD Controller incorrectly calls apply_filters
-
In WooCommerce v5.4.1 the class-wc-rest-crud-controller.php class calls the “rest_{$this->post_type}_collection_params” filter incorrectly:
/** * Filter collection parameters for the posts controller. * * The dynamic part of the filter <code>$this->post_type</code> refers to the post * type slug for the controller. * * This filter registers the collection parameter, but does not map the * collection parameter to an internal WP_Query parameter. Use the * 'rest_{$this->post_type}_query' filter to set WP_Query parameters. * * @param array $query_params JSON Schema-formatted collection parameters. * @param WP_Post_Type $post_type Post type object. */ return apply_filters( "rest_{$this->post_type}_collection_params", $params, $this->post_type );
The PHPDoc states the $post_type variable is meant to be of type WP_Post_Type, however this call provides the parameter as a string.
When WP calls the same filter it provides a WP_Post_Type object.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘REST CRUD Controller incorrectly calls apply_filters’ is closed to new replies.