@@ -2797,26 +2797,41 @@ function wp_set_password( $password, $user_id ) {
27972797 * Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post.
27982798 *
27992799 * @since 2.5.0
2800- * @since 4.2.0 Optional `$args` parameter added.
2800+ * @since 4.2.0 Added the optional `$args` parameter.
2801+ * @since 5.5.0 Added the `loading` argument.
2802+ * @since 6.1.0 Added the `decoding` argument.
2803+ * @since 6.3.0 Added the `fetchpriority` argument.
28012804 *
2802- * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
2805+ * @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash,
28032806 * user email, WP_User object, WP_Post object, or WP_Comment object.
2804- * @param int $size Optional. Height and width of the avatar image file in pixels. Default 96.
2805- * @param string $default_value URL for the default image or a default type. Accepts '404' (return
2806- * a 404 instead of a default image), 'retro' (8bit), 'RoboHash' (robohash),
2807- * 'monsterid' (monster), 'wavatar' (cartoon face), 'indenticon' (the "quilt"),
2808- * 'mystery', 'mm', or 'mysteryman' (The Oyster Man), 'blank' (transparent GIF),
2809- * or 'gravatar_default' (the Gravatar logo). Default is the value of the
2810- * 'avatar_default' option, with a fallback of 'mystery'.
2811- * @param string $alt Optional. Alternative text to use in img tag. Default empty.
2807+ * @param int $size Optional. Height and width of the avatar in pixels. Default 96.
2808+ * @param string $default_value URL for the default image or a default type. Accepts:
2809+ * - '404' (return a 404 instead of a default image)
2810+ * - 'retro' (a 8-bit arcade-style pixelated face)
2811+ * - 'robohash' (a robot)
2812+ * - 'monsterid' (a monster)
2813+ * - 'wavatar' (a cartoon face)
2814+ * - 'identicon' (the "quilt", a geometric pattern)
2815+ * - 'mystery', 'mm', or 'mysteryman' (The Oyster Man)
2816+ * - 'blank' (transparent GIF)
2817+ * - 'gravatar_default' (the Gravatar logo)
2818+ * Default is the value of the 'avatar_default' option,
2819+ * with a fallback of 'mystery'.
2820+ * @param string $alt Optional. Alternative text to use in the avatar image tag.
2821+ * Default empty.
28122822 * @param array $args {
28132823 * Optional. Extra arguments to retrieve the avatar.
28142824 *
28152825 * @type int $height Display height of the avatar in pixels. Defaults to $size.
28162826 * @type int $width Display width of the avatar in pixels. Defaults to $size.
2817- * @type bool $force_default Whether to always show the default image, never the Gravatar. Default false.
2818- * @type string $rating What rating to display avatars up to. Accepts 'G', 'PG', 'R', 'X', and are
2819- * judged in that order. Default is the value of the 'avatar_rating' option.
2827+ * @type bool $force_default Whether to always show the default image, never the Gravatar.
2828+ * Default false.
2829+ * @type string $rating What rating to display avatars up to. Accepts:
2830+ * - 'G' (suitable for all audiences)
2831+ * - 'PG' (possibly offensive, usually for audiences 13 and above)
2832+ * - 'R' (intended for adult audiences above 17)
2833+ * - 'X' (even more mature than above)
2834+ * Default is the value of the 'avatar_rating' option.
28202835 * @type string $scheme URL scheme to use. See set_url_scheme() for accepted values.
28212836 * Default null.
28222837 * @type array|string $class Array or string of additional classes to add to the img element.
@@ -2825,7 +2840,12 @@ function wp_set_password( $password, $user_id ) {
28252840 * Default false.
28262841 * @type string $loading Value for the `loading` attribute.
28272842 * Default null.
2828- * @type string $extra_attr HTML attributes to insert in the IMG element. Is not sanitized. Default empty.
2843+ * @type string $fetchpriority Value for the `fetchpriority` attribute.
2844+ * Default null.
2845+ * @type string $decoding Value for the `decoding` attribute.
2846+ * Default null.
2847+ * @type string $extra_attr HTML attributes to insert in the IMG element. Is not sanitized.
2848+ * Default empty.
28292849 * }
28302850 * @return string|false `<img>` tag for the user's avatar. False on failure.
28312851 */
@@ -2844,8 +2864,8 @@ function get_avatar( $id_or_email, $size = 96, $default_value = '', $alt = '', $
28442864 'force_display ' => false ,
28452865 'loading ' => null ,
28462866 'fetchpriority ' => null ,
2847- 'extra_attr ' => '' ,
28482867 'decoding ' => null ,
2868+ 'extra_attr ' => '' ,
28492869 );
28502870
28512871 if ( empty ( $ args ) ) {
@@ -2883,7 +2903,7 @@ function get_avatar( $id_or_email, $size = 96, $default_value = '', $alt = '', $
28832903 * @since 4.2.0
28842904 *
28852905 * @param string|null $avatar HTML for the user's avatar. Default null.
2886- * @param mixed $id_or_email The avatar to retrieve. Accepts a user_id , Gravatar MD5 hash,
2906+ * @param mixed $id_or_email The avatar to retrieve. Accepts a user ID , Gravatar MD5 hash,
28872907 * user email, WP_User object, WP_Post object, or WP_Comment object.
28882908 * @param array $args Arguments passed to get_avatar_url(), after processing.
28892909 */
@@ -2922,7 +2942,7 @@ function get_avatar( $id_or_email, $size = 96, $default_value = '', $alt = '', $
29222942 }
29232943 }
29242944
2925- // Add `loading`, `fetchpriority` and `decoding` attributes.
2945+ // Add `loading`, `fetchpriority`, and `decoding` attributes.
29262946 $ extra_attr = $ args ['extra_attr ' ];
29272947
29282948 if ( in_array ( $ args ['loading ' ], array ( 'lazy ' , 'eager ' ), true )
@@ -2935,25 +2955,24 @@ function get_avatar( $id_or_email, $size = 96, $default_value = '', $alt = '', $
29352955 $ extra_attr .= "loading=' {$ args ['loading ' ]}' " ;
29362956 }
29372957
2938- if ( in_array ( $ args ['decoding ' ], array ( 'async ' , 'sync ' , 'auto ' ), true )
2939- && ! preg_match ( '/\bdecoding \s*=/ ' , $ extra_attr )
2958+ if ( in_array ( $ args ['fetchpriority ' ], array ( 'high ' , 'low ' , 'auto ' ), true )
2959+ && ! preg_match ( '/\bfetchpriority \s*=/ ' , $ extra_attr )
29402960 ) {
29412961 if ( ! empty ( $ extra_attr ) ) {
29422962 $ extra_attr .= ' ' ;
29432963 }
29442964
2945- $ extra_attr .= "decoding =' {$ args ['decoding ' ]}' " ;
2965+ $ extra_attr .= "fetchpriority =' {$ args ['fetchpriority ' ]}' " ;
29462966 }
29472967
2948- // Add support for `fetchpriority`.
2949- if ( in_array ( $ args ['fetchpriority ' ], array ( 'high ' , 'low ' , 'auto ' ), true )
2950- && ! preg_match ( '/\bfetchpriority\s*=/ ' , $ extra_attr )
2968+ if ( in_array ( $ args ['decoding ' ], array ( 'async ' , 'sync ' , 'auto ' ), true )
2969+ && ! preg_match ( '/\bdecoding\s*=/ ' , $ extra_attr )
29512970 ) {
29522971 if ( ! empty ( $ extra_attr ) ) {
29532972 $ extra_attr .= ' ' ;
29542973 }
29552974
2956- $ extra_attr .= "fetchpriority =' {$ args ['fetchpriority ' ]}' " ;
2975+ $ extra_attr .= "decoding =' {$ args ['decoding ' ]}' " ;
29572976 }
29582977
29592978 $ avatar = sprintf (
@@ -2971,14 +2990,22 @@ function get_avatar( $id_or_email, $size = 96, $default_value = '', $alt = '', $
29712990 * Filters the HTML for a user's avatar.
29722991 *
29732992 * @since 2.5.0
2974- * @since 4.2.0 The `$args` parameter was added .
2993+ * @since 4.2.0 Added the `$args` parameter.
29752994 *
29762995 * @param string $avatar HTML for the user's avatar.
2977- * @param mixed $id_or_email The avatar to retrieve. Accepts a user_id , Gravatar MD5 hash,
2996+ * @param mixed $id_or_email The avatar to retrieve. Accepts a user ID , Gravatar MD5 hash,
29782997 * user email, WP_User object, WP_Post object, or WP_Comment object.
2979- * @param int $size Square avatar width and height in pixels to retrieve.
2980- * @param string $default_value URL for the default image or a default type. Accepts '404', 'retro', 'monsterid',
2981- * 'wavatar', 'indenticon', 'mystery', 'mm', 'mysteryman', 'blank', or 'gravatar_default'.
2998+ * @param int $size Height and width of the avatar in pixels.
2999+ * @param string $default_value URL for the default image or a default type. Accepts:
3000+ * - '404' (return a 404 instead of a default image)
3001+ * - 'retro' (a 8-bit arcade-style pixelated face)
3002+ * - 'robohash' (a robot)
3003+ * - 'monsterid' (a monster)
3004+ * - 'wavatar' (a cartoon face)
3005+ * - 'identicon' (the "quilt", a geometric pattern)
3006+ * - 'mystery', 'mm', or 'mysteryman' (The Oyster Man)
3007+ * - 'blank' (transparent GIF)
3008+ * - 'gravatar_default' (the Gravatar logo)
29823009 * @param string $alt Alternative text to use in the avatar image tag.
29833010 * @param array $args Arguments passed to get_avatar_data(), after processing.
29843011 */
0 commit comments