In an effort to streamline my site’s code, I’m attempting to remove any and all elements that aren’t absolutely necessary for the majority of my audience (standards compliant visual user agents). WordPress adds some tags by default at the top of each page that I won’t need by way of the wp_head function call. The most extensible and efficient method to remove the tags was to write a plugin, which you can download and drop in your wp-content/plugins/ directory:

Less Head Plugin

The wp_head function is a WordPress action hook. There are several functions defined in the wp-includes/general-template.php that are then added as WordPress actions in the wp-includes/default-filters.php file. Here’s the code in the default-filters.php file that adds them as actions:


add_action('wp_head', 'rsd_link');
add_action('wp_head', 'wlwmanifest_link');
add_action('wp_head', 'wp_generator');

So we could comment out or delete these declarations, but that might cause an issue when we upgrade the WordPress install. Instead all we have to do is remove these actions in our plugin:


remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');

Finally, you may be curious as to what exactly these tags are for and why WordPress includes them by default:

  • The RSD link refers to a Really Simple Discovery file, an XML format developed to make it easier for some software to interact with your blog. May be important if RSD becomes more prevalent, but for the time being I am OK with removing it.
  • The wlwmanifest link references a file that is needed for Windows Live Writer interaction. I don’t use Windows Live Writer.
  • The wp_generator function prints a tag displaying your version of WordPress.

Creating a good development environment is obviously very important for any new development project, and with database-driven applications, it’s often a hassle to keep files and data in sync. With this in mind, I tried to come up with an efficient method of pushing a local development copy of this site to its live server.

About

Not Just a Hat Rack (NJHR) focuses on best practice solutions for problems you’ll encounter during a typical site build. There’s an emphasis on new technology when possible (HTML5, CSS3, etc.), but all suggested solutions will work cross-browser, quickly and efficiently. more »

I'm Andrew Church, an aspiring web developer currently living and working in Washington, DC. I’ve been employed as a professional developer since 2004, when I graduated with a degree in Information Sciences & Technology from Penn State University. I'm particularly interested in front-end web development technologies (HTML, CSS, JavaScript), but I do have experience with the entire site build process. « less

Tweets

Delicious