LLMS_REST_Controller::object_inserted( object $object, WP_REST_Request $request, array $schema, bool $creating )

Called right after a resource is inserted (created/updated).


Parameters Parameters

$object

(object) (Required) Inserted or updated object.

$request

(WP_REST_Request) (Required) Request object.

$schema

(array) (Required) The item schema.

$creating

(bool) (Required) True when creating a post, false when updating.


Top ↑

Source Source

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

		// Registered via `register_rest_field()`.
		$fields_update = $this->update_additional_fields_for_object( $object, $request );
		if ( is_wp_error( $fields_update ) ) {
			return $fields_update;
		}

		$this->object_completely_inserted( $object, $request, $schema, true );

		$request->set_param( 'context', 'edit' );

		$response = $this->prepare_item_for_response( $object, $request );

		$response->set_status( 201 );
		$response->header( 'Location', rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $this->get_object_id( $object ) ) ) );

		return $response;


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.12 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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