Speed up yours WordPress site without plugins. Remove all un... open

Speed up yours WordPress site without plugins. Remove all unnecessary.

Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators
Tested: PHP 5.6 +

Over the years, your WordPress the site is overgrown with new features. Often needed, and often not very much. This accumulation of features and processes definitely does not benefit your site. And what if you need the site to remain just a site without any frills and at the same time work faster spending less resources.

This article has put together features that can be removed, turned off to make your WordPress site faster and cleaner. I’m not saying you need to turn off everything here, everyone is checking it for their needs.

1. RSS feeds

On the one hand, RSS feeds can increase traffic to your resource. And not for nothing, so many blogs have an RSS subscription button. But on the other hand, very often information from RSS feeds is stolen by other blogs using special scripts. Agree, not very nice. To solve this problem, let’s look at methods that will help you remove the RSS feed from WordPress once and for all. In addition, the function creates a lot of extra code and connects a bunch of extra files, which in turn also negatively affects the speed of your WordPress site.

2. Disable emoji’s

Since version 4.2, WordPress has had full support for emoji emoticons. If you do not want to use them and you do not need them, then I advise you to completely disable this functionality so as not to clutter up the code with unnecessary styles and scripts. This is very important on highly loaded sites, where every extra byte counts.

3. Disable WordPress REST API

The WordPress JSON REST API technology is needed for external site management. In WordPress, since version 4.4, a feature has been added to the core that allows you to create and edit content without logging into the admin panel. Usually, such tools are used when the WordPress site has a huge amount of materials, and the admin area starts to slow down.

The JSON REST API will allow you to access the content of a WP site using any front end written in one of the currently available WEB languages or an application.

In recent versions of the engine, the REST API has been included in the core. This means that it starts working automatically after installing a fresh copy of WordPress, adding a line on each page of the site: . If you create content only in the admin panel of your site, then this functionality is not needed.

4. Disable jQuery

If you open the source code of your site on WordPress, then in the header of the site you will find something like this lines where the jQuery library itself and jquery-migrate are connected. If your template or functions are written in pure JS, then why load your site with unnecessary scripts. To disable, follow the instructions below.

Or disable jQuery migrate only

jQuery Migrate in WordPress is used to provide compatibility with legacy jQuery features that may have been used in older versions of WordPress or in plugins and themes. It helps keep old jQuery code working when updating WordPress to new versions that may have changes or remove outdated jQuery features. Overall, jQuery Migrate helps avoid conflicts and provides compatibility with legacy jQuery scripts.

It is simply unnecessary for modern themes and plugins
function remove_jquery_migrate( &$scripts ) {
	if ( ! is_admin() ) {
		$scripts->remove( "jquery" );
		$scripts->add( "jquery", false, array( "jquery-core" ) );
	}
}
add_filter( "wp_default_scripts", "remove_jquery_migrate" );

5. Disable RSD edit

Transfer protocol using XML data – it became possible to manage publication remotely from Windows programs and applications.

links looks like:

<link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://site.com/xmlrpc.php?rsd" />
remove_action( 'wp_head', 'rsd_link' );

6. Disable rel wlwmanifest

The wlw manifest link is the ability to edit and modify articles on a WordPress site using the Windows Live Writer program, which is popular among webmasters in a narrow circle.

If you do not use this program, then we recommend that you remove this tag from your theme by adding the code below:

// Disable wlwmanifest link
remove_action('wp_head', 'wlwmanifest_link');

7. Wordpess version generator

Wordpress Version Generator

WordPress, by default, in the header.php file generates a special HTML generator meta tag in the section, which contains information about the current version of WordPress on the site.

To delete, add this code to your function.php file:

//Disable WordPress version generator
remove_action('wp_head', 'wp_generator');

8. DNS prefetch link

Wrong_post_id

DNS-Prefetch, also known as DNS-Prefetching, is a technique used by some web browsers to speed up the DNS lookup process in the background.

For remove add this code in yours funtion.php file

remove_action('wp_head', 'wp_resource_hints', 2);

9. Remove shortlink from html

remove_action('wp_head', 'wp_shortlink_wp_head');

10. Disable Gutenberg styles in header

Gutenberg styles in header

function gtbrg_deregister_styles() {
    wp_dequeue_style( 'global-styles' );
}
add_action( 'wp_enqueue_scripts', 'gtbrg_deregister_styles', 100 );

11. Classic theme styles in header

blank

add_action( 'wp_enqueue_scripts', function() {
    wp_dequeue_style( 'classic-theme-styles' );
}, 20 );

Bonus:

Remove the URL from the comments form:

add_filter('comment_form_default_fields', 'commensts_unset_url_field');

function commensts_unset_url_field($fields)
{
    if (isset($fields['url'])) {
        unset($fields['url']);
    }

    return $fields;
}

Remove WP Block Library


function gutenberg_deregister_styles() {
    wp_dequeue_style( 'extendify-gutenberg-patterns-and-templates-utilities-inline-css' );
}
add_action( 'wp_init', 'gutenberg_deregister_styles', 1 );

function remove_wp_block_library_css(){
    wp_dequeue_style( 'wp-block-library' );
    wp_dequeue_style( 'wp-block-library-theme' );
    wp_dequeue_style( 'wc-blocks-style' ); // Remove WooCommerce block CSS
} 
add_action( 'wp_enqueue_scripts', 'remove_wp_block_library_css', 100 );
0

More

Leave a Reply

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

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation