2

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

1

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
3
  • ok, where exactly i put this lines in the function.php? at the bottom it's fine? Otherwise which plugin you mean to insert these lines of code? Thanks
    – Manna
    Nov 16, 2012 at 11:33
  • Write a custom plugin for your install. Or on the end of the functions.php of the theme.
    – bueltge
    Nov 16, 2012 at 12:00
  • 1
    Preferably in a plugin (very easy to get started) so you don't need to manually port any code over when switching themes
    – Zach
    Nov 16, 2012 at 12:55
0

Remove the following line from the theme’s functions.php:

add_theme_support( 'automatic-feed-links' );

… and add this to the file:

remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.