当我构建主题时,我也喜欢将WordPress的标题尽可能的干净,然后根据自己的喜好重新构建它。下面的代码对于您的问题来说是多余的,但它可能会在将来帮助您使用其他“WordPress插入代码”。您要查找的关键代码片段是
wp_deregister_script(\'jquery\');
wp_register_script(\'jquery\', \'\', \'\', \'\', true);
把这个放进你的
functions.php
文件
我的整个WordPress标题清理:
/* =Clean up the WordPress head
------------------------------------------------- */
// remove header links
add_action(\'init\', \'tjnz_head_cleanup\');
function tjnz_head_cleanup() {
remove_action( \'wp_head\', \'feed_links_extra\', 3 ); // Category Feeds
remove_action( \'wp_head\', \'feed_links\', 2 ); // Post and Comment Feeds
remove_action( \'wp_head\', \'rsd_link\' ); // EditURI link
remove_action( \'wp_head\', \'wlwmanifest_link\' ); // Windows Live Writer
remove_action( \'wp_head\', \'index_rel_link\' ); // index link
remove_action( \'wp_head\', \'parent_post_rel_link\', 10, 0 ); // previous link
remove_action( \'wp_head\', \'start_post_rel_link\', 10, 0 ); // start link
remove_action( \'wp_head\', \'adjacent_posts_rel_link_wp_head\', 10, 0 ); // Links for Adjacent Posts
remove_action( \'wp_head\', \'wp_generator\' ); // WP version
if (!is_admin()) {
wp_deregister_script(\'jquery\'); // De-Register jQuery
wp_register_script(\'jquery\', \'\', \'\', \'\', true); // Register as \'empty\', because we manually insert our script in header.php
}
}
// remove WP version from RSS
add_filter(\'the_generator\', \'tjnz_rss_version\');
function tjnz_rss_version() { return \'\'; }