Home / Custom Default Avatar
Duplicate Snippet

Embed Snippet on Your Site

Custom Default Avatar

Use a custom image for the default avatar.

80+
Code Preview
php
<?php
/**
 * IMPORTANT: After activating this snippet you have to change the default avatar option in Settings » Discussion to "Custom Avatar" as defined below.
 */
add_filter( 'avatar_defaults', function( $avatar_defaults ) {
    $new_avatar_url = 'https://wpcode.com/wp-content/uploads/2024/09/wpcode-avatar.png'; // Replace this with your default avatar image URL.
    $avatar_defaults[$new_avatar_url] = 'Custom Avatar';
    return $avatar_defaults;
});

Comments

Add a Comment