我知道wp_head()很重要,但是使用它会给头部注入很多垃圾。我想把它拿出来,然后手动添加我需要的2-3行代码。
但是,WordPress添加了一些代码,我希望保留这些代码:
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel='canonical' href='http://jlecologia.com/cms/' />
...
<meta http-equiv="Content-Language" content="fr-FR" />这怎么能为我产生呢?( bloginfo('name')之类的东西对我来说很好。)
发布于 2011-03-17 15:25:38
您可以使用以下内容删除一些标头内容。
// remove unncessary header info
function remove_header_info() {
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'start_post_rel_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'adjacent_posts_rel_link');
}
add_action('init', 'remove_header_info');默认安装不包括像元关键字这样的东西,所以这要么是一个主题,要么是你正在使用的插件。
发布于 2011-03-17 15:27:20
看看这里:http://codex.wordpress.org/Plugin_API/行动_参考/wp_头
本质上,您需要为wp_head钩子添加一个操作,并且(可能)删除与wp_head钩子关联的其他操作。
https://wordpress.stackexchange.com/questions/12299
复制相似问题