Make WordPress Core

Changeset 51048


Ignore:
Timestamp:
05/31/2021 03:38:46 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve documentation for the wp_resource_hints filter.

Clarify that as of WordPress 4.7, the $urls parameter can accept arrays of specific HTML attributes as its child elements, in addition to URLs.

Follow-up to [37920], [38826].

Props vanyukov, Rahmohn, desrosj, peterwilsoncc, SergeyBiryukov.
Fixes #52842.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r51019 r51048  
    32953295         *
    32963296         * @since 4.6.0
     3297         * @since 4.7.0 The `$urls` parameter accepts arrays of specific HTML attributes
     3298         *              as its child elements.
    32973299         *
    3298          * @param array  $urls          URLs to print for resource hints.
    3299          * @param string $relation_type The relation type the URLs are printed for, e.g. 'preconnect' or 'prerender'.
     3300         * @param array  $urls {
     3301         *     Array of resources and their attributes, or URLs to print for resource hints.
     3302         *
     3303         *     @type array|string ...$0 {
     3304         *         Array of resource attributes, or a URL string.
     3305         *
     3306         *         @type string $href        URL to include in resource hints. Required.
     3307         *         @type string $as          How the browser should treat the resource
     3308         *                                   (`script`, `style`, `image`, `document`, etc).
     3309         *         @type string $crossorigin Indicates the CORS policy of the specified resource.
     3310         *         @type float  $pr          Expected probability that the resource hint will be used.
     3311         *         @type string $type        Type of the resource (`text/html`, `text/css`, etc).
     3312         *     }
     3313         * }
     3314         * @param string $relation_type The relation type the URLs are printed for,
     3315         *                              e.g. 'preconnect' or 'prerender'.
    33003316         */
    33013317        $urls = apply_filters( 'wp_resource_hints', $urls, $relation_type );
Note: See TracChangeset for help on using the changeset viewer.