How to remove unnecessary elements in the HTML document head

Is there a plugin or something that can help me out with deleting unnecessary elements in my code?

I am in charge of fixing a WordPress site and have been asked to remove the following elements that are not necessary, for example, I don’t have any pagination in my pages but in my code there is still:

  • <link rel="prev" title="Barcelona" href="http://www.creativesquaresummercamp.com/barcelona/" />

  • <link rel="next" title="Frequently Asked Questions"
    href="http://www.creativesquaresummercamp.com/frequently-asked-questions/"
    />

Again with the RSS feed:

  • <link rel="alternate" type="application/rss+xml" title="Creative Square
    Summer Camp RSS2 Feed"
    href="http://www.creativesquaresummercamp.com/feed/" />

How can I clean up the code / delete unnecessary elements?

2 Answers
2

This are default settings fron WordPress.
This was set via wp-includes/default_filters.php or the feed inside your theme.

Check the theme, functions.php for
add_theme_support( 'automatic-feed-links' );
and remove it.

Add this via plugin or functions.php in your theme for remove the different defaults, hints and small description is on the source.

remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'index_rel_link'); // index link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // prev 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 ); // Display relational links for the posts adjacent to the current post.
remove_action( 'wp_head', 'wp_generator' ); // Display the XHTML generator that is generated on the wp_head hook, WP version

Leave a Comment