WP_REST_Response::remove_link() public WP 4.4.0
Removes a link from the response.
{} Это метод класса: WP_REST_Response{}
Хуков нет.
Возвращает
null
. Null. Ничего.
Использование
$WP_REST_Response = new WP_REST_Response(); $WP_REST_Response->remove_link( $rel, $href );
- $rel(строка) (обязательный)
- Link relation. Either an IANA registered type, or an absolute URL.
- $href(строка)
- Only remove links for the relation matching the given href.
По умолчанию: null
Список изменений
С версии 4.4.0 | Введена. |
Код WP_REST_Response::remove_link() WP REST Response::remove link WP 5.7
public function remove_link( $rel, $href = null ) {
if ( ! isset( $this->links[ $rel ] ) ) {
return;
}
if ( $href ) {
$this->links[ $rel ] = wp_list_filter( $this->links[ $rel ], array( 'href' => $href ), 'NOT' );
} else {
$this->links[ $rel ] = array();
}
if ( ! $this->links[ $rel ] ) {
unset( $this->links[ $rel ] );
}
}