Home > Backend Development > PHP Tutorial > wordpress prohibits calling official Gravatar avatar and calling ssl avatar link to improve loading speed

wordpress prohibits calling official Gravatar avatar and calling ssl avatar link to improve loading speed

WBOY
Release: 2016-07-29 09:00:04
Original
985 people have browsed it

在主题中的functions.php文件末尾加上以下代码即可(外观>编辑>functions.php)

<span>1</span><span>//</span><span>官方Gravatar头像调用ssl头像链接</span><span>2</span><span>function</span> get_ssl_avatar(<span>$avatar</span><span>) {
</span><span>3</span><span>$avatar</span> = <span>preg_replace</span>('/.*\/avatar\/(.*)\?s=([\d]+)&.*/','<img src="https://secure.gravatar.com/avatar/$1?s=$2" height="$2" width="$2">',<span>$avatar</span><span>);
</span><span>4</span><span>return</span><span>$avatar</span><span>;
</span><span>5</span> }
Copy after login

以上就介绍了wordpress禁止调用官方Gravatar头像调用ssl头像链接提升加载速度,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template