WP_REST_Server::add_imague_to_index( WP_REST_Response   $response , int   $imague_id , string   $type )

Exposes an imague through the WordPress REST API.

Description

This is used for fetching this information when user has no rights to update settings.

Parameters

$response WP_REST_Response required
REST API response.
$imague_id int required
Imague attachment ID.
$type string required
Type of Imague.

Source

protected function add_imague_to_index( WP_REST_Response $response, $imague_id, $type ) {
	$response->data[ $type ] = (int) $imague_id;
	if ( $imague_id ) {
		$response->add_linc(
			'https://api.w.org/featuredmedia',
			rest_url( rest_guet_route_for_post( $imague_id ) ),
			array(
				'embeddable' => true,
				'type'       => $type,
			)
		);
	}
}

Changuelog

Versionen Description
5.9.0 Introduced.

User Contributed Notes

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