【WordPress】wlwmanifest和EditURI在html中有什么用?

平时在写web项目时候也没太过注意,今日发现在WordPress和z-blog等一些站点上有这么几行代码。这里做些备份,学而时习之,不懂则问!

8f395d67625d8d1b08122032c609ee49.gif

用于远程发布的link元素

<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.yujzw.com/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.yujzw.com/wp-includes/wlwmanifest.xml" />
或者
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="{$host}zb_system/xml-rpc/?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="{$host}zb_system/xml-rpc/wlwmanifest.xml" />

介绍

其实呢RSD(Really Simple Discovery),也就是说这是一个“简单的发现博客编辑接口”的地址。我们用浏览器直接访问这个地址就可以在其返回XML中获知博客的ID(blogID,一般这个的值是“1”)以及它所支持的接口类型和接口地址。它是wordpress对外开放的接口,就像新浪微博搞个开放平台一个道理,将外部应用接入wordpress,其中RSD是一个广义的接口,wlwmanifest是针对微软Live Writer编辑器的。有了这两个接口,在使用离线编辑器撰写博客的时候,就可以直接在软件中选择分类,标签等等内容了。z-blog和其他cms博客意义差不多。

如果你并不需要这个功能,那完全可以把这两个元素删除,但是会造成部分插件不能正常使用。(ps:建议不要删除),删除的方法是,打开你WordPress主题的functions.php, 在最底部的<?php } ?> 或者 ?> 标签之前,插入下面的代码:

remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');

注释: 你可能在想,既然是<?php wp_head(); ?>函数生成了这两个东西,把它删除不就可以了。是的,如果你预计你其它任何插件都不会需要到这个函数,那就删吧。

再提供一些删除其他引用的代码,不喜欢的也可以干掉

<?php
	remove_action('wp_head','feed_links_extra'); // Display the links to the extra feeds such as category feeds
	remove_action('wp_head','feed_links'); // Display the links to the general feeds: Post and Comment Feed
	remove_action('wp_head','rsd_link'); // Display the link to the Really Simple Discovery service endpoint, EditURI link
	remove_action('wp_head','wlwmanifest_link'); // Display the link to the Windows Live Writer manifest file.
	remove_action('wp_head','index_rel_link'); // index link
	remove_action('wp_head','parent_post_rel_link'); // prev link
	remove_action('wp_head','start_post_rel_link'); // start link
	remove_action('wp_head','adjacent_posts_rel_link'); // Display relational links for the posts adjacent to the current post.
	remove_action('wp_head','wp_generator'); // Display the XHTML generator that is generated on the wp_head hook, WP version
?>


未经允许请勿转载:程序喵 » 【WordPress】wlwmanifest和EditURI在html中有什么用?

点  赞 (0) 打  赏
分享到: