是否可以通过编程方式更改 WordPress 中的用户头像?我这么问是因为我现在在 WordPress 多站点中显示用户头像时遇到了一个问题:头像没有显示。
很可能在某个地方get_avatar
调用过滤器并执行某些操作。我建议搜索您的插件和主题get_avatar
并查看类似以下内容的内容:add_filter ('get_avatar', .....
否则,您可以使用下面的代码编写自己的行为。
<?php // in a plugin file or in a theme functions.php
function SO13911452_override_avatar ($avatar_html, $id_or_email, $size, $default, $alt) {
// check all values
return $avatar_html
}
add_filter ('get_avatar', 'SO13911452_override_avatar', 10, 5);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11554 次 |
最近记录: |