woocommerce_rest_{$this->post_type}_trashable

woocommerce_rest_{$this->post_type}_trashable

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_rest_{$this->post_type}_trashable') is found 2 times:

  • /includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php line 1659
    1655
    1656
    1657
    1658
    1659
    1660
    1661
    1662
    1663
    1664
    *
     * @param boolean $supports_trash Whether the item type support trashing.
     * @param WP_Post $post           The Post object being considered for trashing support.
     */
    $supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_trashable", $supports_trash, $post );
     
    if ( ! wc_rest_check_post_permissions( $this->post_type, 'delete', $post->ID ) ) {
        /* translators: %s: post type */
        return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) );
    }
  • /includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php line 434
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    *
     * @param boolean $supports_trash Whether the item type support trashing.
     * @param WP_Post $post           The Post object being considered for trashing support.
     */
    $supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_trashable", $supports_trash, $post );
     
    if ( ! wc_rest_check_post_permissions( $this->post_type, 'delete', $post->ID ) ) {
        /* translators: %s: post type */
        return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) );
    }

See this hook used in plugins: