网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > WordPress
User Name
Password
 
FAQ Members List Calendar Cheap Glasses Mark Forums Read

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   IP: 112.87.85.4
Old 2015-06-14, 06:57 AM
Jenkinjones Jenkinjones is offline
初级会员
 
Join Date: 2006-11-02
Posts: 1
Jenkinjones 现在声名狼藉
Default wordpress 优化wp_head()

所谓优化wp_head()就是把从wp_head中移除不需要元素,同时也可以加快速度。

步骤:

加入到function.php

remove_action('wp_head', 'wp_generator');
//wp-generator移除wordpress的版本号,本身blog的版本号没什么意义,但是如果让恶意玩家看到,可能会用官网公布的漏洞攻击blog

remove_action('wp_head', 'wlwmanifest_link');
//wlwmanifest_link移除wlwmanifest相关信息

remove_action('wp_head','rsd_link');
//rsd_link移除XML-RPC

说明:wlwmanifest_link和rsd_link是为了去除这两行代码:

<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.x.com/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.x.com/wp-includes/wlwmanifest.xml" />

这两行标记都是针对Blog的离线编辑器开放接口所使用的。其中RSD是一个广义的接口,wlwmanifest是针对微软Live Writer编辑器的。有了这两个接口,在使用离线编辑器撰写博客的时候,就可以直接在软件中选择分类,标签等等内容了。如果你不需要离线编辑,却又认为开放的两个接口不够安全,那么就可以禁用掉RSD和wlwmanifest:

加入到header.php的wp_head();上一行(上面的也可以直接放在这个地方)

wp_deregister_script('jquery');

在wp_head();前边加上wp_deregister_script主要作用是去除默认调用的jquery,这个只能在头部文件使用注销默认的调用js文件。去除之后,可以用google的jquery库,减少自身服务器的负担。

方法:在head.php或footer.php文件中(本博在footer.php中)加入

<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js” type=”text/javascript”></script>
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Steps to Change Your Table Prefix in WordPress Abby WordPress 0 2014-04-14 03:40 PM
Install WordPress on IIS topvip Blog(博客)/Wiki(维客)/RSS/Cms 1 2010-01-25 08:31 PM
让wordpress首页显示特殊页面(flash首页等) yahoo Blog(博客)/Wiki(维客)/RSS/Cms 0 2009-02-25 06:58 AM
wordpress 搜索引擎优化的二十条实用技巧 car 搜索引擎优化 0 2008-03-11 08:33 AM
WordPress 中文包 sunshine Blog(博客)/Wiki(维客)/RSS/Cms 0 2007-03-12 10:16 AM

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 07:44 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.