Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Google Cloud Compute Engine

7 Ways for a Lightweight WordPress with Best Performance

by Cloudbooklet
5 years ago
in Compute Engine
7 Ways For A Lightweight Wordpress With Best Performance
ShareTweetSendShare
Readers like you help support Cloudbooklet. When you make a purchase using links on our site, we may earn an affiliate commission.

7 Ways for a Lightweight WordPress with Ultimate Performance. There are many tips out there to optimize the performance of your WordPress website. Here are some unique methods to secure your website and disable some unwanted load on your website like Disable Emoji Remove Query Strings Disable XML-RPC Remove jQuery migrate Remove Meta Generator Tags […]

ADVERTISEMENT

7 Ways for a Lightweight WordPress with Ultimate Performance. There are many tips out there to optimize the performance of your WordPress website.

Here are some unique methods to secure your website and disable some unwanted load on your website like

  • Disable Emoji
  • Remove Query Strings
  • Disable XML-RPC
  • Remove jQuery migrate
  • Remove Meta Generator Tags
  • Remove Manifest, RSD and Shortlinks
  • Disable Pingbacks
  • Disable Rest API Links
  • Disable Dashicons

Disable Emoji

Emoji’s are loaded on every page of your website. It’s actually loaded by a javascript file ( wp-emoji-release.min.js). You can remove Emoji with the following code.

ADVERTISEMENT
add_action('init', '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_dns_prefetch', 10, 2);
add_filter('emoji_svg_url', '__return_false');
}
function disable_emojis_tinymce($plugins) {
if(is_array($plugins)) {
return array_diff($plugins, array('wpemoji'));
} else {
return array();
}
}
function disable_emojis_dns_prefetch( $urls, $relation_type ) {
if('dns-prefetch' == $relation_type) {
$emoji_svg_url = apply_filters('emoji_svg_url', 'https://s.w.org/images/core/emoji/2.2.1/svg/');
$urls = array_diff($urls, array($emoji_svg_url));
}
return $urls;
}

Remove Query Strings

Query strings such as ? or & are added by WordPress to every css and js files for versioning (?ver=5.0.2). You may get a warning about removing this while you do a speed test. Remove the query strings with the following code.

You might also like

How To Install Ansible On Ubuntu 22.04

How to Install Ansible on Ubuntu 22.04

1 year ago
How To Install Php-Fpm With Apache On Ubuntu 22.04

How to Install PHP-FPM with Apache on Ubuntu 22.04

1 year ago
add_action('init', 'remove_query_strings');

function remove_query_strings() {
if(!is_admin()) {
add_filter('script_loader_src', 'remove_query_strings_split', 15);
add_filter('style_loader_src', 'remove_query_strings_split', 15);
}
}
function remove_query_strings_split($src){
$output = preg_split("/(&ver|\?ver)/", $src);
return $output[0];
}

Disable XML-RPC

XML-RPC is used for remote connections. For better security you can remove this from your WordPress.

add_filter('xmlrpc_enabled', '__return_false');
add_filter('wp_headers', 'remove_x_pingback');
add_filter('pings_open', '__return_false', 9999);

function remove_x_pingback($headers) {
unset($headers['X-Pingback'], $headers['x-pingback']);
return $headers;
}

Remove jQuery Migrate

Most latest WordPress themes and plugins won’t use jQuery migrate. In most cases it’s an unnecessary load to your website.

ADVERTISEMENT
add_filter('wp_default_scripts', 'remove_jquery_migrate');

function remove_jquery_migrate(&$scripts) {
if(!is_admin()) {
$scripts->remove('jquery');
$scripts->add('jquery', false, array( 'jquery-core' ), '1.12.4');
}
}

Remove Meta Generator Tags

By default a meta tag is added by WordPress with the version you are using. Why would you show your version of WP to everyone. Just remove it.

remove_action('wp_head', 'wp_generator');
add_filter('the_generator', 'hide_wp_version');

function hide_wp_version() {
return '';
}

Remove Manifest, RSD and Shortlinks

You can safely remove the manifest link if you are not using Windows Live Writer.

ADVERTISEMENT
remove_action('wp_head', 'wlwmanifest_link');

RSD links are mostly unnecessary code.

remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wp_shortlink_wp_head');
remove_action ('template_redirect', 'wp_shortlink_header', 11, 0);

If you are already using permalinks, then you don’t need the shortlinks.

ADVERTISEMENT
remove_action('wp_head', 'wp_shortlink_wp_head');
remove_action ('template_redirect', 'wp_shortlink_header', 11, 0);

Disable Pingbacks

Self Ping backs are simply nothing more a spam.

add_action('pre_ping', 'disable_self_pingbacks');

function disable_self_pingbacks(&$links) {
$home = get_option('home');
foreach($links as $l => $link) {
if(strpos($link, $home) === 0) {
unset($links[$l]);
}
}
}

Disable Rest API Links

Most sites don’t use these, and therefore it’s also just and unnecessary code.

ADVERTISEMENT
remove_action('wp_head', 'rest_output_link_wp_head');
remove_action('template_redirect', 'rest_output_link_header', 11, 0);

Disable Dashicons

Dashicons is the official font used for icons by WordPress. If you don’t need dashicons you can remove this from your front end except all admin pages.

add_action('wp_enqueue_scripts', 'disable_dashicons');

function disable_dashicons() {
if(!is_admin()) {
wp_dequeue_style('dashicons');
wp_deregister_style('dashicons');
}
}

Where do you add these codes?

You can add these codes to your child-theme’s functions.php file.

Tags: Ubuntu 18.04WordPress
ShareTweetSendShare
Cloudbooklet

Cloudbooklet

Leave a Reply Cancel reply

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

Related Posts

How To Install And Setup Mern Stack With Nginx On Ubuntu

How to Install and Setup MERN Stack with Nginx on Ubuntu

2 years ago
Best Performance Wordpress With Google Cloud Cdn And Load Balancing

Best Performance WordPress with Google Cloud CDN and Load Balancing

2 years ago
Install Cpanel On Ubuntu

How to Install cPanel & WHM on Ubuntu 20.04

2 years ago
How To Install And Setup Csf

How to Secure your Ubuntu server with CSF Firewall

2 years ago

Follow Us

Trending Articles

Ai Girl Generator

7 Best AI Girl Generators for Creating Realistic and Beautiful AI Girls

September 19, 2023

How to Use ChatGPT to Translate Your Website or Blog

Amazon Prime Big Deal Days 2023: Best Deals

10 Best AI Song Generator in 2023 (Free and Paid)

5 Free AI Soulmate Maker: Create Your Perfect Match

AI Annotation Jobs: Everything You Need to Know

Popular Articles

Who Unfollowed You On Instagram

How to Find Who Unfollowed You on Instagram

September 11, 2023

How to Easily Remove Background in Microsoft Paint and Paint 3D

10 Best Free AI Porn Generators in 2023

18+ Best Free NSFW AI Generators of 2023

DreamGF – Best NSFW AI Website to Have Fun for FREE

7 Best AI Finance Tools That Will Transform Your Business in 2023

Subscribe Now

loader

Subscribe to our mailing list to receives daily updates!

Email Address*

Name

Cloudbooklet Logo

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Applications
  • Linux

Cloudbooklet © 2023 All rights reserved.