Caching Wordpress avatar always uses a component Generic Gravatar Cache , which has been used for a long time. But it will generate a lot of useless garbage in the cache directory! Very unhappy. Do you want to clean it? Now it's good. The method is particularly simple. Just modify the source code. The test is all right
Well, there's a lot of nonsense. Let's see how to change it. My theme is inove (randomly modified), so change the functions.php in the root directory of the theme Find this line:
<img src='/index/thumb.png' data-original="***" alt="" width="32" height="32" />
In fact, it is in the comments. Add the following code in front of it:
<? php $f = md5(strtolower($comment->comment_author_email)); $a = get_bloginfo('wpurl') .'/ gravatar/'.$f.'.jpg'; $e = ABSPATH . ' gravatar/'.$f.'.jpg'; $t = 1209600; $d = get_bloginfo('wpurl'). '/ gravatar/default-gravatar.jpg'; if ( ! is_file($e) || (time() - filemtime($e)) > $t ){ $r = get_option('avatar_rating'); $g = ' http://www.gravatar.com/avatar/ '.$ f.'?s=32&d='.$d.'&r='.$r; copy($g, $e); } if (filesize($e) < 500) {copy($d, $e);} ?>
It's so simple. Have you seen the effect?
Nothing else needs to be changed. The sidebar can be used again. Theoretically, it can be called as a function. Unfortunately, I'm a novice and don't understand
It's said to be from Master Willin Mini gravatar avatar cache method
see wordpress php gravatar Related articles for
Please specify that the original article of this website is reproduced from To be kicked , Link: https://www.itlu.net/articles/1406.html