Removing WordPress Header Junk

Place the following code in your functions.php file of your WordPress theme to remove some useless things from the head of your site.

There are a lot of things that WordPress adds to the head of your site. These can all be removed using the remove_action function that WordPress provides in your functions.php file.

// functions.php      // =========================================================================     // REMOVE JUNK FROM HEAD     // =========================================================================     remove_action('wp_head', 'rsd_link'); // remove really simple discovery link     remove_action('wp_head', 'wp_generator'); // remove wordpress version      remove_action('wp_head', 'feed_links', 2); // remove rss feed links (make sure you add them in yourself if youre using feedblitz or an rss service)     remove_action('wp_head', 'feed_links_extra', 3); // removes all extra rss feed links      remove_action('wp_head', 'index_rel_link'); // remove link to index page     remove_action('wp_head', 'wlwmanifest_link'); // remove wlwmanifest.xml (needed to support windows live writer)      remove_action('wp_head', 'start_post_rel_link', 10, 0); // remove random post link     remove_action('wp_head', 'parent_post_rel_link', 10, 0); // remove parent post link     remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0); // remove the next and previous post links     remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );      remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 );  

For more information on the remove_action and cleaning up your WordPress head, check out the official docs.

0 0 đánh giá
Đánh giá bài viết
Theo dõi
Thông báo của

0 Góp ý
Phản hồi nội tuyến
Xem tất cả bình luận