WP_REST_Controller::get_additional_fields()
Retrieves all of the registered additional fields for a given object-type.
Метод класса: WP_REST_Controller{}
Хуков нет.
Возвращает
Массив
. Registered additional fields (if any), empty array if none or if the object type could not be inferred.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_additional_fields( $object_type );
- $object_type(строка)
- The object type.
По умолчанию: null
Заметки
- Global. Массив. $wp_rest_additional_fields Holds registered fields, organized by object type.
Список изменений
С версии 4.7.0 | Введена. |
Код WP_REST_Controller::get_additional_fields() WP REST Controller::get additional fields WP 6.8.1
protected function get_additional_fields( $object_type = null ) { global $wp_rest_additional_fields; if ( ! $object_type ) { $object_type = $this->get_object_type(); } if ( ! $object_type ) { return array(); } if ( ! $wp_rest_additional_fields || ! isset( $wp_rest_additional_fields[ $object_type ] ) ) { return array(); } return $wp_rest_additional_fields[ $object_type ]; }