Optimising WordPress for SEO by removing default assets

If you’re working on a fully bespoke WordPress theme, there are a number of default assets you can likely remove from WordPress to streamline the loading times of your new site.


Out of the box, WordPress loads a number of stylesheets and script files that you are unlikely to require if you’re working on a fully bespoke WordPress theme. The code snippet below removes non-essential assets such as emoji styles, support for oEmbeds when linking to other WordPress sites (introduced in WordPress 4.4) and styles for the Gutenberg Block Library that WordPress has shipped with since 5.0.

Lowering the number of individual asset files that are required to be downloaded and parsed before your site can load is likely to have a positive effect on your PageSpeed Insights score.

/**
 * Remove junk
 */

remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');

/**
 * Remove unnecessary scripts
 *
 * @return void
 */

function deregister_scripts() {
    wp_deregister_script( 'wp-embed' );
}

add_action( 'wp_footer', 'deregister_scripts' );


/**
 * Remove unnecessary styles
 *
 * @return void
 */

function deregister_styles() {
    wp_dequeue_style( 'wp-block-library' );
}

add_action( 'wp_print_styles', 'deregister_styles', 100 );

A lightweight, intuitive WordPress theme to enable flexible developement.

  • Lighting-fast installer
  • Intuitive SASS structure
  • Bloat-free

Build with Barebones