• Resolved sjregan

    (@sjregan)


    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)
  • Plugin Support Sol J. a11n

    (@solstudioim)

    Hi there @sjregan

    Thanks a lot for your report!

    In WooCommerce v5.4.1 the class-wc-rest-crud-controller.php class calls the “rest_{$this->post_type}_collection_params” filter incorrectly

    Please kindly create an issue on our repository so our developers can have a look further 🙂

    Plugin Support Thu P. a11n

    (@thup90)

    Hi there,

    Since we’ll handle the report on our Github repo, I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘REST CRUD Controller incorrectly calls apply_filters’ is closed to new replies.