acf_get_field_rest_links()
Get the REST API field links for a given field. The links are appended to the REST response under the _links property and provide API resource links to related objects. If a link is marked as 'embeddable', WordPress can load the resource in the main request under the _embedded property when the request contains the _embed URL parameter.
Хуки из функции
Возвращает
Массив.
Использование
acf_get_field_rest_links( $post_id, $field );
- $post_id(строка|int) (обязательный)
- .
- $field(массив) (обязательный)
- .
Заметки
- Смотрите: [acf_field::get_rest_links()](/plugin/acf/function/acf_field::get_rest_links)
- Смотрите: https://developer.wordpress.org/rest-api/using-the-rest-api/linking-and-embedding/
Код acf_get_field_rest_links() acf get field rest links ACF 6.4.2
function acf_get_field_rest_links( $post_id, array $field ) {
$value = acf_get_value( $post_id, $field );
$type = acf_get_field_type( $field['type'] );
$links = $type->get_rest_links( $value, $post_id, $field );
/**
* Filter the REST API links for a given field.
*
* @param array $links
* @param string|int $post_id
* @param array $field
* @param mixed $value
*/
return (array) apply_filters( 'acf/rest/get_field_links', $links, $post_id, $field, $value );
}