Make WordPress Core


Ignore:
Timestamp:
06/30/2021 12:33:43 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Docs: Document the globals used in some REST API methods.

See #53399.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php

    r50952 r51278  
    505505     * @since 4.7.0
    506506     *
     507     * @global array $wp_rest_additional_fields Holds registered fields, organized by object type.
     508     *
    507509     * @param string $object_type Optional. The object type.
    508      * @return array Registered additional fields (if any), empty array if none or if the object type could
    509      *               not be inferred.
     510     * @return array Registered additional fields (if any), empty array if none or if the object type
     511     *               could not be inferred.
    510512     */
    511513    protected function get_additional_fields( $object_type = null ) {
     514        global $wp_rest_additional_fields;
    512515
    513516        if ( ! $object_type ) {
     
    518521            return array();
    519522        }
    520 
    521         global $wp_rest_additional_fields;
    522523
    523524        if ( ! $wp_rest_additional_fields || ! isset( $wp_rest_additional_fields[ $object_type ] ) ) {
Note: See TracChangeset for help on using the changeset viewer.