WC_REST_Posts_Controller::update_item_permissions_check()
Check if a given request has access to update an item.
Method of the class: WC_REST_Posts_Controller{}
No Hooks.
Return
WP_Error|true|false
.
Usage
$WC_REST_Posts_Controller = new WC_REST_Posts_Controller(); $WC_REST_Posts_Controller->update_item_permissions_check( $request );
- $request(WP_REST_Request) (required)
- Full details about the request.
WC_REST_Posts_Controller::update_item_permissions_check() WC REST Posts Controller::update item permissions check code WC 9.5.1
public function update_item_permissions_check( $request ) { $post = get_post( (int) $request['id'] ); if ( $post && ! wc_rest_check_post_permissions( $this->post_type, 'edit', $post->ID ) ) { return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); } return true; }