By default, WordPress loads a lot of unnecessary boilerplate in the header, mostly via wp_head.

The following functions remove a good number of unnecessary <head> outputs, as well as removes some unnecessary CSS and JavaScript files. These changes can improve the speed and security of your WordPress theme.

The code snippets in this blog post perform a variety of WordPress clean-up functions:

  • Removes a variety of unnecessary <head> metas and links
  • Removes the WordPress version from the front-end
  • Disables all emoji functionality
  • Disables unauthenticated requests to REST API routes
  • Removes Gutenberg CSS
  • Removes jQuery Migrate from the front-end
  • Removes the WordPress oEmbed script

Add any of the functions below to your functions.php file to remove some of these unnecessary WordPress output items.

Remove unnecessary wp_head actions and output

 * Remove unnecessary wp_head actions and output
remove_action ( 'wp_head', 'rsd_link' ); // remove xml rpc
remove_action(  'wp_head', 'wlwmanifest_link' ); // remove manifest
remove_action(  'wp_head', 'wp_shortlink_wp_head' ); // remove shortlink
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
remove_action( 'template_redirect', 'rest_output_link_header', 11, 0 );

Remove WordPress version from markup

* Remove the output of WP version
function remove_wp_version() {
  return '';

add_filter( 'the_generator', 'remove_wp_version' ) ;

Disable Emojis and remove related scripts

 * Disable emojis
function disable_emojis() {
  remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
  remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
  remove_action( 'wp_print_styles', 'print_emoji_styles' );
  remove_action( 'admin_print_styles', 'print_emoji_styles' );
  remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
  remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
  remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
  add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
  add_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 );
  add_filter( 'emoji_svg_url', '__return_false' ); // remove dns prefetch for emoji

add_action( 'init', 'disable_emojis' );

 * Filter function used to remove the tinymce emoji plugin.
 * @param array $plugins
 * @return array Difference betwen the two arrays
function disable_emojis_tinymce( $plugins ) {
  if ( is_array( $plugins ) ) {
    return array_diff( $plugins, array( 'wpemoji' ) );
  } else {
    return array();

 * Remove emoji CDN hostname from DNS prefetching hints.
 * @param array $urls URLs to print for resource hints.
 * @param string $relation_type The relation type the URLs are printed for.
 * @return array Difference betwen the two arrays.
function disable_emojis_remove_dns_prefetch( $urls, $relation_type ) {
  if ( 'dns-prefetch' == $relation_type ) {
    /** This filter is documented in wp-includes/formatting.php */
    $emoji_svg_url = apply_filters( 'emoji_svg_url', '' );

    $urls = array_diff( $urls, array( $emoji_svg_url ) );

  return $urls;

Disable unauthenticated REST API requests

 * Disable unauthenticated REST API requests
function disable_unauthenticated_rest( $result ) {

  // If a previous authentication check was applied, pass that result along without modification.
  if ( true === $result || is_wp_error( $result ) ) {
    return $result;

  // disable response if not logged in
  if ( ! is_user_logged_in() ) {
    return new \WP_Error(
        __( 'Access denied' ),
        array( 'status' => 401 )

  return $result;

add_filter( 'rest_authentication_errors', 'disable_unauthenticated_rest' );

Remove oEmbed script

 * Remove oembed script
function remove_oembed_script(){
  wp_deregister_script( 'wp-embed' );

add_action( 'wp_footer', 'remove_oembed_script' );

Remove Gutenberg block CSS

 * Remove Gutenberg CSS
 * Obviously you should not add this if you are using Gutenberg blocks
function remove_block_css() {
  wp_dequeue_style( 'wp-block-library' );

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

Remove jQuery Migrate

 * Remove jQuery Migrate
function remove_jquery_migrate( $scripts ) {
  if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
    $script = $scripts->registered['jquery'];
    if ( $script->deps ) {
      $script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );

add_action( 'wp_default_scripts', 'remove_jquery_migrate' );

Note, make sure you do not need any of these items in your theme, plugins, or somewhere else on your WordPress site before implementing them.

Our Services

What we do

  • Custom Web Design and Development

  • WordPress Design & Development

  • Responsive and Mobile Websites

  • Web Applications

  • Website Modifications and Maintenance

  • Domain Name (DNS) Management

  • Hosting and Server Configuration

  • Speed Optimization

  • Content Management & Updates

We specialize in websites and applications for small to medium sized businesses and non-profit organizations.
Whether it's a simple static website, or complex CMS-based solution, having a site custom-built to suit your business needs is always a superior option compared to off-the-shelf themes or cheap templates. We work closely with clients to advise upon and deliver custom solutions individually tailored to the most ideal specifications for their project.
In 2016 it was estimated that over 26% of websites online are built on WordPress, making it the most widely used web platform in the world. With the popularity of WordPress has come powerful refinements to the platform to make it applicable to a wide variety of web projects, not just simple blogs.
Mobile internet traffic has long surpassed that of desktop and laptop computers. Having a website that is optimized for mobile viewing and use is a must in the world of modern technology. We offer both mobile-specific sites and responsive solutions that work across all screen sizes, carefully tested along the way for maximum cross-device compatibility and support.
Have a larger project that requires user authentication, more complex functionality, or highly extendible and scalable features? Or a project that isn't necessarily a sensible fit for CMS-based sites like Wordpress, Magento, or Shopify? We work with the most up-to-date technologies to build fast and reliable applications from the ground up.
We offer a variety of maintenance packages and hourly maintenance work. Whether your site needs a new feature, plugin, or a general redesign we have you covered. Get in touch so we can have a look at your project and provide you with an estimate.
Domain name mapping is an essential part of any web project. All of our work includes this service but if you have additional DNS routing or issues you need help with we'd be more than happy to help you out.
Choosing the right type of hosting for your project is vital to your site's performance and maintainability. It's an important step to address long before you deploy your project to avoid future problems and costs with your web investment. We offer managed hosting packages or advice and help with choosing the right hosting provider(s) and getting your project up and running on a live server.
Website speed, page size, and load times are likely the most important factors in running an effective website. We offer a variety of solutions for speeding up slow websites from server configuration & caching to managing page sizes and code modifications.

Configuring your server, moving hosts, optimizing code and databases, reducing image sizes and using proper file formats, and enabling compression on your server are just some of the items we examine in getting your site to run more efficiently.
Your site's content is of equal importance to its functionality. Managing HTML, images, and copy to look good on all devices can be challenging with little knowledge of code. To get your online content looking as professional as possible across desktop, tablet, and mobile devices, we can input and manage the content on your site for you to make managing your site as fast and painless as possible.

Temparc Web logoContact Us

Request a quote or reach out

Interested in working with us? Drop us a line including some information about your project and we'd be happy to get back to you with an estimate as soon as we can.