Gravatar image url is wrong?

As the filename suggests, it’s a default for when someone does not have a gravatar assigned. It is set up in your child theme and looks to be improperly set. You should search through the child theme files to find ‘wpb-default-gravatar.png’ and from there figure out what is adding the extra domain. If this is … Read more

Custom Field Repeating When Using foreach

if you want to use multiple users, if you will add usernames comma separated in custom field. try below code. function user_avatar() { $user = “”; $names = get_post_meta( get_the_ID(), ‘user_name’, true ); $user_names = array_map(‘trim’, explode(‘,’, $names)); if(!empty($user_names)) { foreach ($user_names as $key => $user_name) { $user = get_user_by( ‘login’, $user_name ); if($user) { … Read more

Gravatar – Default IMG

Your code actually works, it is just that you can’t do what you want. The way gravatar works is by serving the image if it has one and redirecting to the supplied default if it doesn’t, so even if the default is on your server you still can’t avoid the redirect. And gravatar really makes … Read more

How to prevent a specific users’s profile photo (gravatar) from showing on the frontend to other users?

Use this hook function to replace user’s avatar (which is passed in as HTML <img …> tag) if user’s ID or email matches your condition. You can use any other default image, or get individual replacement image for each user. function my_get_avatar($avatar, $id_or_email, $size, $default, $alt) { if ($id_or_email == “[email protected]”) { $img = “http://path.to/default/avatar.jpg”; … Read more

Fetching Gravatar

You can use get_avatar. The following example prints an avatar in 96 px, assuming that you have the user id stored in $user_id, and prints a fallback user.png if no such user or image could be found. echo get_avatar($user_id, 96, get_stylesheet_directory_uri() . ‘/images/user.png’);

Change the “Default Avatar” admin option via functions.php

You can just update the option field avatar_default to your new image url: add_filter( ‘avatar_defaults’, ‘mytheme_default_avatar’ ); function mytheme_default_avatar( $avatar_defaults ) { $avatar = get_option(‘avatar_default’); $new_avatar_url = get_template_directory_uri() . ‘/images/default_avatar.png’; if( $avatar != $new_avatar_url ) { update_option( ‘avatar_default’, $new_avatar_url ); } $avatar_defaults[ $new_avatar_url ] = ‘Default Avatar’; return $avatar_defaults; }

Which Function Displays The Post Authors Gravatar

Notice: get_the_author_ID is deprecated since version 2.8! Use get_the_author_meta(‘ID’) instead. in C:\Users\Administrator\Desktop\www.wpsites.dev\wp-includes\functions.php on line 2908 You aren’t using get_the_author_meta(‘ID’); as instructed by the Notice. You are just using get_the_author_meta(). The latter returns an empty string when I try it. Reference http://codex.wordpress.org/Function_Reference/get_the_author_meta

Which core file is responsible for gravatars?

I still think Rarst’s answer is better and that there is no need to remove Gravatar links in the core WordPress files, but … The files you are looking for are: /wp-admin/credits.php /wp-admin/options-discussion.php /wp-content/plugins/akismet/akismet.js /wp-includes/pluggable.php /wp-includes/post-template.php Since you may need to do this every time WordPress updates, you could search the WordPress files for the … Read more