Missing Gravator profile pic after changing Wordpress username
13 April, 2013 by Tom Elliott
If you have recently changed your WordPress username by using the method of creating a new admin user and deleting the old admin user, or using the Better WP Security plugin, then you may find your established Gravatar profile picture is suddenly missing from all previous post comments.
This is because the above methods of changing your WordPress username will rename your admin “user_id” in the WordPress “users” and “usermeta” table, but won’t change the user_id associated with your previous post comments, which means Gravatar won’t display your profile pic belonging to the recently changed admin username.
If you can see you Gravatar profile picture from the user list in WordPress admin, and creating a new comment shows the profile pic correctly then the following quick steps should fix your Gravatar picture:
- Login to your WordPress database using PHPMyAdmin or whatever database management tool you use
- Make a note of your new user ID by finding your user details in the “users” table and checking the “ID” field
- Make a note of your old user ID by finding an old admin post comment within the “comments” table and checking the “user_id” field.
- Change all instances of the new “user_id” in the “usermeta” table to the old user ID
- Change the main ID of your profile in the “users” table to the old user ID
Your Gravatar profile picture should now be back in all its glory for all post comments! You should re-login to WordPress administration now your user details have been changed.
Security suggestion: You should use a different user_id from the default “1” by installing the excellent Better WP Security plugin.
This fix worked for me, thank you.
This is what I got from my host.
mysql> UPDATE wp_comments SET user_id = ‘XX’ WHERE user_id = ‘1’;
XX is the new user_id number.