Are you on the hunt for accelerating your WordPress site? Quick loading of web pages uplifts the client experience, improves your site visits, and assists with your WordPress SEO. Today, we’ll explore the most valuable WordPress speed optimizations tips that will definitely help to accelerate your website speed.
We have attempted to cover everything from why speed is significant, what hinders your WordPress site, and noteworthy tips that you can try to improve your WordPress speed right away.
WordPress is not at all heavy, yet the plugins you use may hinder the page load time. There are numerous strategies that can help you accelerate your WordPress site like Utilizing CDN (Content Delivery Network), browser and server reserving, and using some lightweight themes.
Let’s get started!
Query Strings
Whenever you are investigating your site for load time, at that point you may have gone over a proposal to dispose off query strings from static assets like CSS and JS files. Presence of query strings in the files may disable CDN in caching the files, i.e. you may not be using all the possible and available benefits. Well, for removing the query strings, you must add the underneath code:
function remove_cssjs_ver( $src ) {
if( strpos( $src, ‘?ver=’ ) )
$src = remove_query_arg( ‘ver’, $src );
return $src;
}
add_filter( ‘style_loader_src’, ‘remove_cssjs_ver’, 10, 2 );
add_filter( ‘script_loader_src’, ‘remove_cssjs_ver’, 10, 2 );
RSD Links
Really Simple Discovery is required in the event that you plan to utilize XML-RPC client, pingback, and so on. Still, on the off chance that you needn’t bother with pingback or remote client to manage post, at that point dispose of this useless header by including the accompanying code.
remove_action( ‘wp_head’, ‘rsd_link’ ) ;
Emoticons
Suspend additional code associated with emoticons from WordPress which was added lately to integrate emojis in one of the previous browsers. Code you need to execute is:
remove_action(‘wp_head’, ‘print_emoji_detection_script’, 7);
remove_action(‘wp_print_styles’, ‘print_emoji_styles’);
remove_action( ‘admin_print_scripts’, ‘print_emoji_detection_script’ );
remove_action( ‘admin_print_styles’, ‘print_emoji_styles’ );
Embeds
WordPress established oEmbed functionalities in 4.4 which permits any website to insert WordPress post remotely. You can use the underneath code which will keep others from inserting your blog entry and impair loading related JS file.
function disable_embed(){
wp_dequeue_script( ‘wp-embed’ );
}
add_action( ‘wp_footer’, ‘disable_embed’ );
XML-RPC
For publishing, editing posts, comments, or for uploading a file,
do you have a necessity to utilize WordPress API (XML-RPC)? Well, having XML-RPC empowered might prompt DDoS and even brute force attacks. Use the code for disabling XML-RPC:
add_filter(‘xmlrpc_enabled’, ‘__return_false’);
WordPress Version
Disabling WordPress version might not help in better performance yet more to alleviate information leakage vulnerability. WordPress includes meta name generator which has the version details. It is noticeable in source code and HTTP header. For disabling WordPress version, use the below code:
remove_action( ‘wp_head’, ‘wp_generator’ ) ;
JQuery Migrate
WordPress included JQuery migration from version 3.6 which isn’t required in the event that you are utilizing the most recent version of JQuery and themes/plugin are fit for it. To suspend jquery-migrate.min.js from loading, you can include beneath code:
function deregister_qjuery() {
if ( !is_admin() ) {
wp_deregister_script(‘jquery’);
}
}
add_action(‘wp_enqueue_scripts’, ‘deregister_qjuery’);
Post Revisions
In case of a browser crash, post revisions are not supportive to reestablish the post. WordPress automatically saves revisions for each draft, and this might bloat the database. In this case, you must disable it or limit its usage. For disabling post revisions, use the code:
define(‘WP_POST_REVISIONS’, false);
For limiting the number, the code will be (for the case you need to limit it to 3):
define(‘WP_POST_REVISIONS’, 3);
Heartbeat
WordPress utilizes heartbeat API for communication with a program to a server by continually calling admin-ajax.php. It might hinder the entire overall page load time and develop CPU usage in case of shared hosting. On the off chance that you don’t have a necessity to use heartbeat API, you must disable it by using the underneath code.
add_action( ‘init’, ‘stop_heartbeat’, 1 );
function stop_heartbeat() {
wp_deregister_script(‘heartbeat’);
}
Dashicons on Front-end
Dashicons are used in the admin console, and in the event that you don’t use them, you might need to disable it. By including underneath, dashicons.min.css will quit loading on the front-end. For disabling the dash icon on the front end, you must use the code:
function wpdocs_dequeue_dashicon() {
if (current_user_can( ‘update_core’ )) {
return;
}
wp_deregister_style(‘dashicons’);
}
add_action( ‘wp_enqueue_scripts’, ‘wpdocs_dequeue_dashicon’ );
Contact Form 7 JS/CSS
While working on Contact Form 7, did you observe their CSS/JavaScript files get loaded on each page? Well, don’t worry because it is a common issue experienced by all of us. However, you can quit loading it by using the with beneath code:
add_filter( ‘wpcf7_load_js’, ‘__return_false’ );
add_filter( ‘wpcf7_load_css’, ‘__return_false’ );
You might spend hours and days to find ways for improving the website speed, however the above ones can help you rapidly improve the website speed and performance without plugins.