avatar_defaults
Filter HookDescription
Filters the default avatars. Avatars are stored in key/value pairs, where the key is option value, and the name is the displayed avatar name.Hook Information
File Location |
wp-admin/options-discussion.php
View on GitHub
|
Hook Type | Filter |
Line Number | 323 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$avatar_defaults
|
Associative array of default avatars. |
Usage Examples
Basic Usage
<?php
// Hook into avatar_defaults
add_filter('avatar_defaults', 'my_custom_filter', 10, 1);
function my_custom_filter($avatar_defaults) {
// Your custom filtering logic here
return $avatar_defaults;
}
Source Code Context
wp-admin/options-discussion.php:323
- How this hook is used in WordPress core
<?php
318 *
319 * @since 2.6.0
320 *
321 * @param string[] $avatar_defaults Associative array of default avatars.
322 */
323 $avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults );
324 $default = get_option( 'avatar_default', 'mystery' );
325 $avatar_list = '';
326
327 // Force avatars on to display these choices.
328 add_filter( 'pre_option_show_avatars', '__return_true', 100 );
PHP Documentation
<?php
/**
* Filters the default avatars.
*
* Avatars are stored in key/value pairs, where the key is option value,
* and the name is the displayed avatar name.
*
* @since 2.6.0
*
* @param string[] $avatar_defaults Associative array of default avatars.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-admin/options-discussion.php
Related Hooks
Related hooks will be displayed here in future updates.