LLMS_REST_Enrollments_Controller::delete_item( WP_REST_Request $request )

Deletes a single llms post.


Parameters Parameters

$request

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


Top ↑

Return Return

(WP_REST_Response|WP_Error) Response object on success, or WP_Error object on failure.


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/server/class-llms-rest-enrollments-controller.php

		}

		return true;

	}

	/**
	 * Deletes a single llms post.
	 *
	 * @since 1.0.0-beta.1
	 * @since 1.0.0-beta.10 The`trigger` param is now taken into account.
	 *                     Also fix return when the enrollment to be deleted doesn't exist.
	 *
	 * @param WP_REST_Request $request Full details about the request.
	 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
	 */
	public function delete_item( $request ) {

		$response = new WP_REST_Response();
		$response->set_status( 204 );

		$enrollment_exists = $this->enrollment_exists( (int) $request['id'], (int) $request['post_id'], $request['trigger'] );

		if ( is_wp_error( $enrollment_exists ) ) {
			// Enrollment not found, we don't return a 404.


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.10 Thetrigger param is now taken into account. Also fix return when the enrollment to be deleted doesn't exist.
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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