This website uses cookies to allow us to see how the site is used. If you continue to use this site, we assume that you are okay with this. If you want to use the sites without cookies, please see our privacy policy.

WordPress Speed Improvement Snippets

WordPress out of the box is quite an efficient piece of software, however with recent developments it can be more bloated than it could be. Since going freelance, about 40% of my work has been improving the speed of WordPress for sites. Most of that has been removing bloat.

There are plenty of plugins out there that do a lot of work to improve speed. However I’ve a light, one file plugin that removes some of the standard functionality. This file includes the following:-

  • Switches off emoji support.
  • Removes the “generator” line in the head.
  • Removes oEmbeds.
  • Removes feed creation.

This plugin is installed on client sites, and is designed to be simple and lightweight, and do a few small jobs well.

	Plugin Name: Dwi'n Rhys Speed Improvement Plugin
	Plugin URI:
	Description: Plugin used to do a bunch of speed changes. Will be documented at a later point.
	Version: 0.1
	Author: Dwi'n Rhys
	Author URI:
	License: GPL v3

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <>.

 * Switch off emoji scripts from loading.
 * To disable this, add define('DWINRHYS_ENABLE_EMOJIS', 1 ); to your wp-config.php file
if ( ! defined( 'DWINRHYS_ENABLE_EMOJIS' ) ) {
	remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
	remove_action( 'wp_print_styles', 'print_emoji_styles' );

 * Remove the WP Generator
 * To disable this, add define('DWINRHYS_ENABLE_WPGENERATOR', 1 ); to your wp-config.php file
if ( ! defined( 'DWINRHYS_ENABLE_WPGENERATOR' ) ) {
	remove_action( 'wp_head', 'wp_generator' );

 * Switch off embeds from loading.
 * To disable this, add define('DWINRHYS_ENABLE_EMBEDS', 1 ); to your wp-config.php file
if ( ! defined( 'DWINRHYS_ENABLE_EMBEDS' ) ) {
	add_action( 'wp_footer', 'dwinrhys_dequeue_embeds' );

 * Switch off RSS Feeds
 * To disable this, add define('DWINRHYS_ENABLE_FEEDS', 1 ); to your wp-config.php file
if ( ! defined( 'DWINRHYS_ENABLE_FEEDS' ) ) {
	remove_action( 'wp_head', 'feed_links', 2 );
	remove_action( 'wp_head', 'feed_links_extra', 3 );

 * Function to disable embeds
 * @return void
function dwinrhys_dequeue_embeds() {
	wp_dequeue_script( 'wp-embed' );

Re-enabling Certain Features

Now, not every site will need these features disabling, and especially with clients you may want to leave a few of these features on. To do so, you can add the following lines to your wp-config.php file.

define('DWINRHYS_ENABLE_EMOJIS', 1 ); // Enable Emojis
define('DWINRHYS_ENABLE_WPGENERATOR', 1 ); // Enable Generator Line
define('DWINRHYS_ENABLE_EMBEDS', 1 ); // Enable Embeds
define('DWINRHYS_ENABLE_FEEDS', 1 ); // Enable Feeds.


Rhys is a WordPress developer, conference organiser & international conference speaker based in Manchester UK, freelancing as @dwinrhys. He has a broad face and a little round belly that shakes when he laughs, like a bowl full of jelly.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.