WP_REST_Meta_Fields::prepare_value

Advertisement

Summery Summery

Prepares a meta value for output.

Syntax Syntax

WP_REST_Meta_Fields::prepare_value( mixed $value, WP_REST_Request $request, array $args )

Description Description

Default preparation for meta fields. Override by passing the prepare_callback in your show_in_rest options.

Parameters Parameters

$value

(Required) Meta value from the database.

$request

(Required) Request object.

$args

(Required) REST-specific options for the meta key.

Return Return

(mixed) Value prepared for output. If a non-JsonSerializable object, null.

Source Source

File: wp-includes/rest-api/fields/class-wp-rest-meta-fields.php

		foreach ( $fields as $args ) {
			$schema['properties'][ $args['name'] ] = $args['schema'];
		}

		return $schema;
	}

	/**
	 * Prepares a meta value for output.
	 *
	 * Default preparation for meta fields. Override by passing the
	 * `prepare_callback` in your `show_in_rest` options.
	 *
	 * @since 4.7.0
	 *
	 * @param mixed           $value   Meta value from the database.

Advertisement

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.

Advertisement

Leave a Reply