Filter hook 'rest_avatar_sizes'

in WP Core File wp-includes/rest-api.php at line 1308

View Source

rest_avatar_sizes

Filter Hook
Description
Filters the REST avatar sizes. Use this filter to adjust the array of sizes returned by the `rest_get_avatar_sizes` function.

Hook Information

File Location wp-includes/rest-api.php View on GitHub
Hook Type Filter
Line Number 1308

Hook Parameters

Type Name Description
int[] $sizes An array of int values that are the pixel sizes for avatars. Default `[ 24, 48, 96 ]`.

Usage Examples

Basic Usage
<?php
// Hook into rest_avatar_sizes
add_filter('rest_avatar_sizes', 'my_custom_filter', 10, 1);

function my_custom_filter($sizes) {
    // Your custom filtering logic here
    return $sizes;
}

Source Code Context

wp-includes/rest-api.php:1308 - How this hook is used in WordPress core
<?php
1303  	 * @since 4.4.0
1304  	 *
1305  	 * @param int[] $sizes An array of int values that are the pixel sizes for avatars.
1306  	 *                     Default `[ 24, 48, 96 ]`.
1307  	 */
1308  	return apply_filters( 'rest_avatar_sizes', array( 24, 48, 96 ) );
1309  }
1310  
1311  /**
1312   * Parses an RFC3339 time into a Unix timestamp.
1313   *

PHP Documentation

<?php
/**
	 * Filters the REST avatar sizes.
	 *
	 * Use this filter to adjust the array of sizes returned by the
	 * `rest_get_avatar_sizes` function.
	 *
	 * @since 4.4.0
	 *
	 * @param int[] $sizes An array of int values that are the pixel sizes for avatars.
	 *                     Default `[ 24, 48, 96 ]`.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/rest-api.php
Related Hooks

Related hooks will be displayed here in future updates.