LLMS_Post_Relationships::rest_filter_products_with_active_subscriptions_error_message( WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response, array $handler, WP_REST_Request $request )
Filter the error message returned when trying to delete a product with active subscription via REST API.
Description Description
The original message is a standard permission denied message.
Parameters Parameters
- $response
-
(WP_REST_Response|WP_HTTP_Response|WP_Error|mixed) (Required) Result to send to the client. Usually a WP_REST_Response or WP_Error.
- $handler
-
(array) (Required) Route handler used for the request.
- $request
-
(WP_REST_Request) (Required) Request used to generate the response.
Return Return
(WP_REST_Response|WP_HTTP_Response|WP_Error|mixed)
Source Source
File: includes/class.llms.post.relationships.php
public static function rest_filter_products_with_active_subscriptions_error_message( $response, $handler, $request ) { if ( is_wp_error( $response ) ) { foreach ( $response->errors as $code => &$data ) { // Error code can be produced by our rest-api or by wp core. if ( in_array( $code, array( 'llms_rest_cannot_delete', 'rest_cannot_delete' ), true ) ) { $data[0] = self::delete_product_with_active_subscriptions_error_message( $request['id'] ); break; } } } return $response; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.4.0 | Introduced. |