WordPress.org

Forums

Cleaning up wp_head (5 posts)

  1. wpCodemonkey
    Member
    Posted 5 years ago #

    I have recently been creating a bare bones theme and there is some stuff in wp_head() that irritates me and frankly should not be in there.

    <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://domain.com/xmlrpc.php?rsd" />
    <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://domain.com/wp-includes/wlwmanifest.xml" />

    Windows live writer should not be enabled like this by default it should be a plugin.

    <link rel='index' />
    <meta name="generator" content="WordPress 2.8.6" />

    (rel="index") until microformats become standard that shouldn't really be in there by default. Leave it up to theme designers whether they wish to use microformats or not.

    The meta generator add useless information to the <head> and should not be there. The footer link is enough to promote wordpress and publishing the version number in use in a publicly accessible format is a security risk.

    Also the recent comments widget injects the following into the <head>

    <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>

    The way to style widgets is via the register_sidebar() function and utilizing the before_widget and after_widget array keys. There should be no css styling in the default codebase. Please remove this in a future update.

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    The meta generator add useless information to the <head> and should not be there. The footer link is enough to promote wordpress and publishing the version number in use in a publicly accessible format is a security risk.

    To remove this line, add:

    remove_action ('wp_head', 'wp_generator');

    to the top of your theme's function.php file (just after the opening <?php)

  3. wpCodemonkey
    Member
    Posted 5 years ago #

    Thanks for the response, but I know how to remove them.
    I posted in the beta area as I thinks the above wp_head() actions should be removed from the standard codebase.

    For anyone who wishes to remove them via remove_action() the commands to add to functions.php are

    remove_action('wp_head', 'rsd_link');
    remove_action('wp_head', 'wlwmanifest_link');
    remove_action('wp_head', 'index_rel_link');
    remove_action('wp_head', 'wp_generator');
  4. humbleopinion
    Member
    Posted 5 years ago #

    I tried to put remove_action ('wp_head', 'wp_generator'); in the function.php file and it didn't change anything, version was still there.

    What I did do is found
    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>
    in the header file and changed the version to abc.
    <meta name="generator" content="WordPress <?php bloginfo('abc'); ?>
    so what it did was put in the file my blog name:
    <meta name="generator" content="WordPress *MY Weblog*" />

  5. stratboy
    Member
    Posted 4 years ago #

    The thing I think you omitted to write was this:

    The functions you are removing are here:
    wp-includes/default-filters.php

    And the add_action calls that define all that junk are here:
    wp-includes/general-template.php

    :) You know, to be complete.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags