To clean the header in WordPress, unnecessary code can be removed by adding specific code to the functions.php file of the theme or child theme in use. Unneeded elements such as RSS feed links, WordPress version information, random and parent post links, and more can be eliminated. This optimization will help improve page performance. Following WordPress tips can provide more insight and knowledge on this topic. For additional articles, one can follow the fanpage “Hocwordpress Group” for the latest updates. Overall, cleaning the header in WordPress is a simple trick that can enhance website efficiency.
Are you looking to clean up the header section of your WordPress website? If so, you’re in the right place! WordPress tends to include a bunch of unnecessary code in the header, and it’s perfectly fine if you want to get rid of it.
Some of the code you might want to remove includes the "Really simple discovery link (rsd_link)", "WordPress version (wp_generator)", "RSS feed links (feed_links and feed_links_extra)", and more. To remove this code from your WordPress header, all you need to do is add some code to the functions.php file of your theme or child theme.
Here’s a snippet of code that you can add to functions.php:
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
remove_action('wp_head', 'feed_links_extra', 3); // remove 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
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 next and previous post links
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0); // Remove shortlink
By adding this code, you’ll be able to streamline your header section and improve the performance of your website. It’s a simple yet effective trick that can make a big difference!
If you found this tip helpful, be sure to check out our other WordPress tips for more useful information. And don’t forget to follow our fanpage for the latest updates and articles. Hope you enjoy exploring the world of WordPress!