Astra_Addon_Theme_Builder::delete_permissions_check( WP_REST_Request $request )

Check whether a given request has permission to delete route.


Description


Parameters

$request

(WP_REST_Request) (Required) Full details about the request.


Return

(WP_Error|boolean)


Source

File: addons/advanced-hooks/classes/class-astra-addon-theme-builder.php

		public function delete_permissions_check( $request ) {
			$post_id = $request['id'];
			if ( current_user_can( 'delete_post', $post_id ) ) {
				return true;
			} else {
				return new WP_Error(
					'rest_forbidden',
					__( 'You do not have permission to delete this item.', 'astra-addon' ),
					array( 'status' => 403 )
				);
			}
		}

Changelog

Changelog
Version Description
4.5.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.