/ Published in: PHP
I use this to toss all the junk from the header, add a favicon, remove useless admin elements, and block WordPress' ancient jQuery file from embedding.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php if (!is_admin()) wp_deregister_script('jquery'); wp_deregister_script('l10n'); automatic_feed_links(); } else { return; } remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'feed_links', 2); remove_action('wp_head', 'index_rel_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'feed_links_extra', 3); remove_action('wp_head', 'start_post_rel_link', 10, 0); remove_action('wp_head', 'parent_post_rel_link', 10, 0); remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0); function blog_favicon() { echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.get_bloginfo('wpurl').'/favicon.ico" />'; } add_action('wp_head', 'blog_favicon'); function theme_admin_bar_render() { global $wp_admin_bar; $wp_admin_bar->remove_menu('comments'); $wp_admin_bar->remove_menu('appearance'); } add_action( 'wp_before_admin_bar_render', 'theme_admin_bar_render' );