Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_REST_Fields::register_fields_for_certificate_awards()

Register rest fields used for awarded certificates.


Return Return

(void)


Top ↑

Source Source

File: includes/class-llms-rest-fields.php

	private function register_fields_for_certificate_awards() {

		register_rest_field(
			'llms_my_certificate',
			'certificate_template',
			array(
				'schema'          => array(
					'description' => __( 'Certificate template ID.', 'lifterlms' ),
					'type'        => 'integer',
					'arg_options' => array(
						'validate_callback' => function( $value ) {
							return ! $value || 'llms_certificate' === get_post_type( $value );
						},
					),
				),
				'get_callback'    => function( $object ) {
					return wp_get_post_parent_id( $object['id'] );
				},
				'update_callback' => function( $value, $post ) {
					$update = array(
						'ID'          => $post->ID,
						'post_parent' => $value,
					);
					return wp_update_post( $update );
				},
			)
		);

	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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