Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
Coppa WPB
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Come cambiare il Gravatar predefinito su WordPress (Tutorial facile)

Nota editoriale: guadagniamo una commissione dai link dei partner su WPBeginner. Le commissioni non influenzano le opinioni o le valutazioni dei nostri redattori. Per saperne di più su Processo editoriale.

Volete cambiare il Gravatar predefinito sul vostro sito WordPress?

Se un commentatore non ha un Gravatar, WordPress mostrerà di default la stessa “persona misteriosa” grigia. Sostituendo questa immagine di repertorio con un’immagine a vostra scelta, potete personalizzare la sezione dei commenti in base al vostro marchio e farla risaltare.

In questo articolo vi mostreremo come cambiare il Gravatar predefinito su WordPress.

How to change the default Gravatar on WordPress

Cos’è un Gravatar predefinito e perché cambiarlo?

Gravatar è l’acronimo di Globally Recognized Avatar. È un servizio web che consente alle persone di creare un profilo e di associare immagini avatar al proprio indirizzo e-mail.

Tutti i siti WordPress hanno il supporto integrato per i Gravatar e mostreranno automaticamente l’avatar dell’utente quando scrive post su un blog WordPress multi-autore o lascia commenti.

Se un utente non ha un Gravatar, WordPress mostrerà invece un Gravatar predefinito. Per la maggior parte dei siti WordPress, si tratta di una persona grigia e misteriosa.

The default Gravatar in WordPress

È possibile cambiare questo Gravatar predefinito con qualsiasi altra immagine di propria scelta. Ad esempio, si può utilizzare un’immagine che rappresenti la propria azienda, come il logo del proprio sito web. Questo può contribuire a rafforzare il vostro marchio.

Detto questo, vediamo come modificare l’immagine Gravatar predefinita sul vostro sito o blog WordPress. Utilizzate semplicemente i collegamenti rapidi per passare direttamente al metodo che desiderate utilizzare:

Metodo 1: Scegliere un altro Gravatar integrato in WordPress (facile e veloce)

WordPress viene fornito con alcuni diversi Gravatar predefiniti che è possibile utilizzare. L’utilizzo delle impostazioni predefinite è il modo più rapido per cambiare il Gravatar di una persona misteriosa, anche se queste immagini non saranno uniche per il vostro sito o marchio WordPress.

Per vedere i diversi Gravatar predefiniti, è necessario andare su Impostazioni ” Discussione dall’area di amministrazione di WordPress.

Changing the default Gravatars in WordPress

Sotto la voce “Avatar predefinito”, si vedranno tutti i diversi avatar incorporati che WordPress può utilizzare quando non c’è un Gravatar collegato all’indirizzo e-mail della persona.

WordPress utilizza di default la persona misteriosa, ma è possibile utilizzare qualsiasi altra immagine in questa sezione.

The built-in WordPress Gravatars

È sufficiente fare clic sul pulsante di opzione accanto all’immagine che si desidera utilizzare sul proprio blog WordPress.

Quindi, scorrere fino alla parte inferiore della schermata e fare clic su “Salva modifiche”.

Clicking the 'Save Changes' button on the WordPress Discussion settings page

Metodo 2: Utilizzare Thrive Comments per caricare un Gravatar personalizzato (metodo del plugin)

Se non vi piacciono le opzioni gravatar fornite da WordPress, potete caricare un gravatar personalizzato. Questo è il modo migliore per personalizzare la sezione dei commenti in base al vostro marchio.

Per questo metodo, utilizzeremo Thrive Comments. Si tratta di un plugin per i commenti progettato per incoraggiare gli utenti a commentare i post del vostro blog e aumentare il coinvolgimento del vostro sito web.

Oltre a una funzione gravatar personalizzata, Thrive Comments è dotato di strumenti che rendono la sezione dei commenti più divertente ed emozionante. Ad esempio, è possibile attivare i “mi piace” e i “non mi piace”, i “voti in su” e i “voti in giù”, proprio come in un sito di social media.

The Thrive Comments WordPress plugin

È possibile ottenere Thrive Comments come plugin singolo o acquistare la suite completa di Thrive Themes. Questa include tutti i prodotti Thrive, come Thrive Ovations, che può trasformare i commenti in testimonianze.

Dopodiché, potete scaricare un pacchetto zip di plugin da installare sul vostro sito WordPress. Per ulteriori informazioni, leggete la nostra guida passo-passo su come installare un plugin di WordPress.

Con il plugin installato e attivato, si può andare su Thrive Dashboard “ Thrive Comments dall’area di amministrazione di WordPress. Quindi, aprire la scheda “Personalizza stile”.

In questa scheda, assicurarsi che l’impostazione “Visualizza avatar” sia attivata. Una volta fatto, basta fare clic su “Scegli immagine”.

Choosing a custom gravatar in Thrive Comments

A questo punto, è possibile scegliere un’immagine esistente dalla libreria multimediale di WordPress o caricare la propria da utilizzare come gravatar predefinito.

È possibile utilizzare una foto stock, creare un logo personalizzato o anche creare una nuova immagine Gravatar utilizzando un software di web design come Canva. L’immagine deve essere di forma quadrata, ad esempio 250×250 pixel.

Una volta scelta l’immagine, fare clic su “Seleziona”.

Selecting a gravatar image in the WordPress media library using Thrive Comments

E il gioco è fatto!

Ora dovreste vedere il vostro nuovo gravatar predefinito nell’anteprima e nella sezione dei commenti live.

Example of a comment after the Thrive Comments plugin is activated

Metodo 3: Inserire uno snippet di codice per utilizzare un Gravatar personalizzato (metodo del codice)

Oltre a utilizzare Thrive Comments, è possibile caricare un gravatar personalizzato utilizzando il codice. Si può preferire questo metodo se si vuole semplicemente aggiungere una nuova immagine all’elenco dei gravatar nella pagina di discussione di WordPress.

Come nel secondo metodo, è necessario disporre di un’immagine che si desidera utilizzare come gravatar.

Dopodiché, potete caricare l’immagine sul vostro sito WordPress andando su Media ” Aggiungi nuovo. Qui potete scegliere un’immagine dalla libreria multimediale di WordPress o caricare un nuovo file dal vostro computer.

How to upload a custom default Gravatar in WordPress

Una volta scelta l’immagine, fare clic sul link “Modifica” accanto ad essa.

WordPress aprirà il file per la modifica. In questa schermata, scorrere fino alla sezione “URL del file”.

Uploading a default WordPress Gravatar

Prendete nota di questo URL, perché vi servirà nella fase successiva.

In questa fase, è necessario aggiungere del codice al vostro sito WordPress. Spesso le esercitazioni vi chiederanno di aggiungere degli snippet personalizzati al file functions.php del vostro tema.

Tuttavia, non lo consigliamo perché anche un piccolo errore nel codice può causare errori comuni di WordPress o rompere completamente il vostro sito web.

Ecco perché vi consigliamo di utilizzare WPCode. È il modo più semplice e sicuro per aggiungere codice personalizzato in WordPress senza dover modificare alcun file centrale di WordPress.

La prima cosa da fare è installare e attivare il plugin gratuito WPCode. Per maggiori dettagli, consultate la nostra guida passo-passo su come installare un plugin di WordPress.

Dopo l’attivazione, andate su Code Snippets “ Add Snippet nella vostra dashboard di WordPress.

How to add a custom avatar snippet to your WordPress website

Qui potrete vedere tutti i diversi snippet che potete aggiungere al vostro sito WordPress. Questi includono snippet che consentono di disabilitare completamente i commenti in WordPress, di caricare file SVG sul vostro sito e altro ancora.

Poiché stiamo aggiungendo uno snippet personalizzato, passare il mouse su “Aggiungi il tuo codice personalizzato” e fare clic su “Usa snippet”.

Showing a custom avatar using code

Per iniziare, inserite un titolo per lo snippet di codice personalizzato. Può essere qualsiasi cosa che aiuti a identificare lo snippet nella dashboard di WordPress.

Successivamente, è necessario aprire il menu a tendina “Tipo di codice” e fare clic su “Snippet PHP”.

How to add a PHP snippet in WordPress

Una volta fatto ciò, è sufficiente incollare il seguente snippet nell’editor di codice:

<?php
add_filter( 'avatar_defaults', 'wpb_new_gravatar' );

function wpb_new_gravatar($avatar_defaults) {
    // Replace the URL below with your own Gravatar image URL
    $myavatar = 'http://example.com/wp-content/uploads/2017/01/wpb-default-gravatar.png';

    $avatar_defaults[$myavatar] = "Default Gravatar";
    return $avatar_defaults;
}
?>

Non dimenticate di sostituire l’URL con un link all’immagine che volete usare come Gravatar predefinito di WordPress.

Sotto il riquadro del codice sono presenti alcune opzioni di inserimento. Se non è già selezionata, scegliete il metodo “Inserimento automatico”, in modo che lo snippet venga inserito ed eseguito automaticamente in tutto il sito.

Quindi, aprire il menu a tendina “Posizione” e fare clic su “Esegui ovunque”.

How to run PHP gravatar code across your website

Una volta fatto ciò, è necessario scorrere fino alla parte superiore dello schermo e fare clic sulla levetta “Inattivo” in modo che diventi “Attivo”.

Infine, fare clic su “Salva” per rendere attivo lo snippet Gravatar.

How to activate the gravatar code snippet

Per iniziare a usare questo Gravatar, andare alla pagina Impostazioni ” Discussione”.

Nella sezione “Avatar predefinito”, selezionare la nuova opzione “Gravatar predefinito”.

How to change the default Gravatar in WordPress

Quindi, fare clic su “Salva modifiche” per memorizzare le impostazioni.

Ora, se visitate il vostro sito web, vedrete la nuova immagine Gravatar predefinita.

An example of a custom defualt Gravatar, on a WordPress website

Ecco fatto! Per saperne di più sui gravatar in WordPress, consultate queste guide:

Speriamo che questo articolo vi abbia aiutato a capire come cambiare il Gravatar predefinito su WordPress. Potreste anche voler consultare la nostra guida su come moderare i commenti in WordPress e il nostro elenco dei migliori plugin per commenti di WordPress.

Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per le esercitazioni video su WordPress. Potete trovarci anche su Twitter e Facebook.

Divulgazione: I nostri contenuti sono sostenuti dai lettori. Ciò significa che se cliccate su alcuni dei nostri link, potremmo guadagnare una commissione. Vedi come WPBeginner è finanziato , perché è importante e come puoi sostenerci. Ecco il nostro processo editoriale .

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Il kit di strumenti WordPress definitivo

Ottenete l'accesso gratuito al nostro kit di strumenti - una raccolta di prodotti e risorse relative a WordPress che ogni professionista dovrebbe avere!

Reader Interactions

118 commentiLascia una risposta

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Francis says

    Hi guys,

    Wonderful tutorial, you saved me from a big headache! Keep up the great work!!!

    Best regards,

    Francis

    • WPBeginner Support says

      We do not have a recommended method at the moment but if that changes we will be sure to share.

      Admin

  3. Aardha says

    This worked like a charm. Thanks!! Is there a way to have multiple default gravatar which can be assigned randomly to users ?

    • WPBeginner Support says

      You would need a plugin for a feature like that, if we find a plugin we would recommend we will certainly share.

      Admin

  4. David says

    This is not working. WordPress does not allow to use local images. Please review your tutorial and update it accordingly.

    • WPBeginner Support says

      If our method was not able to assist, you would likely want to reach out to your theme’s support to ensure there isn’t a theme-specific setting preventing the change.

      Admin

  5. Karen says

    Okay, I found an easier solution for everyone that works well: just install the “WP User Avatar” plugin. Works like a charm and you don’t have to do anything with coding!

  6. Mari Alonso says

    This is great, thanks! I followed this by installing the plugin to add the code and then adding my 250×250 picture. It worked great, but now if anyone comments on my site, my picture, not theirs, shows up next to their name. My picture shows up everywhere and no one else’s. Any idea why?

    Thank you. :-)

  7. Lilly says

    Thank you for this post!! I use All in one SEO and could never get it to work. Your post provided a good map and work around. However I am still getting 12 error msgs? are they possible related?

    • WPBeginner Support says

      It would depend on the specific errors. If you reach out to the plugin’s support they should be able to assist.

      Admin

  8. Andreia Esteves says

    Thank you for this post! But, what if I just want to change my personal avatar without using gravatar?

  9. Giga says

    I want an option where the user can upload an image as per their requirements. What should I do for that ?

  10. Mahdi says

    ty – its worked for me – but now default avatar loded from other site – how i can define that this image loaded from my host?

    • WPBeginner Support says

      You’re likely using the Jetpack plugin and using their option to load images from their server. You can go into Jetpack’s settings to disable this function.

      Admin

        • WPBeginner Support says

          If you mean you want your gravatar image to be loaded from your site when it is added to other sites, that is not an option at the moment.

  11. Brian says

    Hey so I have sort of a peculiar yet distinct task that I need help with. My client has a blog on WordPress but then they post their blog to Twitter, next to the article is a gray blank avatar. She had requested that I find a way to put some sort of image in place of this but I am not sure how to go about doing this. I know she uses a Gravatar for the comment section but this instance is a bit different. Any advice on what I can do?

  12. Ryô says

    Hello, the code works well, but I made some changes to my newly added avatar picture and I still see the first version when I refresh the page.

    Looking at the url of the picture it automatically added “http://i2.wp.com/” at the beginning (I don’t have jetpack or any cache plugins).

    I guess I can just change the name of my picture and update the code, but is it a way to get ride of wp cache?

  13. Ana says

    I have no problem changing the image on my gravatar but I cannot seem to change the words. Even though I select edit and rewrite them, the change doesn’t appear on my wordpress site. What am I doing wrong?

  14. Pat says

    Thank you, thank you, thank you! I’ve looked everywhere on how to change the default avatar and you were the only ones who simple explained it and displayed how! Sometimes finding the answer in the haystack of information can be just mind blowing. You rock!

  15. Joy says

    Hello, I’ve tried this in my child’s theme function and it just will not work. The image in the discussion settings and on the front-end appear broken. When I right click to view the path it displays:

    It affixes the i1.wp.com before the link. Even when I tried to connect directly to the child theme stylesheet directory and pickup from the folder, ‘images/chicken_avatar.png’, it still affixed the i1.wp.com

    Any ideas how to fix this? Thank you.

    • WPBeginner Support says

      Hey Joy,

      We tested it again with a child theme and it worked as expected. We are not sure what may be causing the issue. You can follow the instructions again. Make sure you add the full image URL in the code.

      Admin

      • Andrew says

        It Still Shows i0.wp.com/MySite Whwn Going to the Image Location, but I Changed the URL Code to (‘/custom-gravatar/mh-profile-photo-default.png’), Instead of ‘example.com/wp-content/uploads/2017/09/mh-profile-photo-default.png’). In Settings > Discussion It Shows My Admin Photo as the Default User Gravatar, but On User Profiles, It Views Properly! :–)

  16. Mayaprakash Pant says

    Hello.

    The code worked perfectly fine for me. But this arises another problem:

    Same gravatar appears when everyone else including visitor comments on my blog.

    How to solve this?

  17. Gabrielle says

    Hi, i added and sucesfully saved input(type = url) for each user profile, on ly localhost installation.
    I’m trying to change original code from WP Codex wesbsite:

    From:
    add_filter( ‘avatar_defaults’, ‘new_default_avatar’ );

    function new_default_avatar ( $avatar_defaults ) {
    //Set the URL where the image file for your avatar is located
    $new_avatar_url = get_bloginfo( ‘template_directory’ ) . ‘/images/new_default_avatar.png’;
    //Set the text that will appear to the right of your avatar in Settings>>Discussion
    $avatar_defaults[$new_avatar_url] = ‘Your New Default Avatar’;
    return $avatar_defaults;
    }

    To something that will replace default avatar url foreach user with value from custom input field(if its not empty), any help?
    I know there are plugins that allows subsciribers to upload gravatar images, but i don’t want to allow them doing that, i want to give them a chance to put url to their own images

  18. Claire Benneth says

    THANK YOU!

    Actually I’ve been looking for this solution for my blog for 3 months!
    Thanks again!

    Claire xo

  19. Jen Hardy says

    I have the Gravatar set up in WordPress, but when the e-mail goes out to my followers for my blog, the mystery man is there. Looks really bad at the top of my e-mail. Any suggestions?

    Thanks!

  20. Syed Hamza says

    Here are two folders of images in Cpanel.
    1. /public_html/wp-includes/images
    2. /public_html/wp-content/themes/divi/images

    In which folder where I upload the image.

  21. Michael says

    I’m looking for a plugin, or SIMPLE code solution that will allow me to create a number of ‘default’ gravatar/avatar images that are color coded based on the member’s gender/orientation. Obvious ones like blue for male, pink for female, but I’ll likely add lavender for transgender and possibly others. Basically, the decision about the ‘default’ avatar that appears for the member (until they upload an image) would at least let people browsing the site know if the person they see posting (or online) is male / female / transgender / etc.. Any ideas?

  22. Me says

    Is there code to force the default avatar to be blank? I have it set to blank in the WP settings, but it’s still showing up as mystery man. Is there code to either delete mystery man entirely so it’s not even an option. Or to make sure it’s blank and not mystery man? Thanks!

  23. Michael says

    How would one go about rotating a set of images in that Gravatar thumbnail spot? Meaning: if I had 5 different images, to have them randomly appear for users without Gravatars, so there was a variation of the 5?

  24. Angelica Costa says

    If anyone is facing issues with child themes, just use:

    $myavatar = get_stylesheet_directory_uri().’/img/favicon.png’;

    It works.

    • Thomas says

      Goto Gravatar website and sign in with WordPress. Then you can upload your avatar and tie it to one or more of your emails.

  25. Sadia says

    Thank you so much for these instructions. For some reason, things were wonky when I used a .png file, but a gif worked easy peasy!

  26. Katelyn says

    I am having the same issue as Keely. I am using a child theme so get_bloginfo does not work. When I check the URL of the broken image it displays the path to the parent theme. Is there a way to get this to work with a child theme?

Lascia una risposta

Grazie per aver scelto di lasciare un commento. Tenga presente che tutti i commenti sono moderati in base alle nostre politica dei commenti e il suo indirizzo e-mail NON sarà pubblicato. Si prega di NON utilizzare parole chiave nel campo del nome. Avremo una conversazione personale e significativa.