lcp

How to optimize WordPress Website without plugins?

Optimize (Optimise) wordpress website without plugins:

Speeding up WordPress website is essential for any personal or business portfolio. Moreover, your website speed is a major factor in SEO. I will show you how to optimize a WordPress website without any plugins.

The page loading speed can affect your business. It influences everything user satisfaction, from traffic to bounce rate to conversions, and, ultimately, profits. Slow speed websites lead to lost customers or audience.

In this tutorial, we gonna look up how you can improve website speed without using plugins. We are going to make some tweaks that will improve GTmetrix, google page insights (Lighthouse) and obviously Pingdom speed test.

Let’s get started on how to optimise website

optimize wordpress without plugins

1. wp-config tweaks:

As WordPress continuously uses database queries we need to optimise queries that are being called by WordPress. Below are some scripts which can do this task for you. You can find wp-config.php in WordPress (or website) home directory.

define('AUTOSAVE_INTERVAL', 120); //Increase autosave time to 2 minutes 
define('EMPTY_TRASH_DAYS', 7 ); //Empty up trashbin in 7 days instead of 30
define('WP_POST_REVISIONS', 5); //Limit previous post revisions to 5

2. PageSpeed-Leverage browser caching:

This is a simple tweak that will optimise your website, You can set cache of static content easily with the below script (best for WordPress but can be used with other websites also): Go to the home directory of your website then edit .htaccess file copy the following code at the end of the file. This will help a lot in WordPress optimization without any plugin.

# Expires headers (for better cache control)
<IfModule mod_expires.c>
	ExpiresActive on
	ExpiresDefault                              "access plus 1 month"
	# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
	ExpiresByType text/cache-manifest           "access plus 0 seconds"
	# Your document html
	ExpiresByType text/html                     "access plus 0 seconds"
	# Data
	ExpiresByType text/xml                      "access plus 0 seconds"
	ExpiresByType application/xml               "access plus 0 seconds"
	ExpiresByType application/json              "access plus 0 seconds"
	# Feed
	ExpiresByType application/rss+xml           "access plus 1 hour"
	ExpiresByType application/atom+xml          "access plus 1 hour"
	# Favicon (cannot be renamed)
	ExpiresByType image/x-icon                  "access plus 1 week"
	# Media: images, video, audio
	ExpiresByType image/gif                     "access plus 4 months"
	ExpiresByType image/png                     "access plus 4 months"
	ExpiresByType image/jpeg                    "access plus 4 months"
	ExpiresByType image/webp                    "access plus 4 months"
	ExpiresByType video/ogg                     "access plus 4 months"
	ExpiresByType audio/ogg                     "access plus 4 months"
	ExpiresByType video/mp4                     "access plus 4 months"
	ExpiresByType video/webm                    "access plus 4 months"
	# HTC files  (css3pie)
	ExpiresByType text/x-component              "access plus 1 month"
	# Webfonts
	ExpiresByType font/ttf                      "access plus 4 months"
	ExpiresByType font/otf                      "access plus 4 months"
	ExpiresByType font/woff                     "access plus 4 months"
	ExpiresByType font/woff2                    "access plus 4 months"
	ExpiresByType image/svg+xml                 "access plus 1 month"
	ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
	# CSS and JavaScript
	ExpiresByType text/css                      "access plus 1 year"
	ExpiresByType application/javascript        "access plus 1 year"
</IfModule>

read more about PageSpeed: Leverage browser caching

3. GZIP compression:

What is GZIP-Compression? how it affects in website optimisation?

optimize wordpress without plugins

Gzip compression is a method which can compress or decompress various text files in a website like HTML, CSS, js etc. When enabled GZIP compression on a website, it compresses the files inside the server and then handovers to the client. Automatically, it improves a website’s speed, load time, and saves bandwidth of hosting and data usage of the user.

This is another quick tweak to compress various files that are used by WordPress in the backend. So this also required .htaccess file to have the following code paste it in the end and save it.

# BEGIN GZIP COMPRESSION
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
# END GZIP COMPRESSION

4. Enable DEFLATE Compression in .htaccess:

Deflate is kind of lossless data compression format that uses a combination of Huffman coding and LZSS. In the apache server, you can use the following code in your .htaccess file, which presents in the website’s home directory.

# BEGIN DEFLATE COMPRESSION
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE "application/atom+xml" \
"application/javascript" \
"application/json" \
"application/ld+json" \
"application/manifest+json" \
"application/rdf+xml" \
"application/rss+xml" \
"application/schema+json" \
"application/vnd.geo+json" \
"application/vnd.ms-fontobject" \
"application/x-font-ttf" \
"application/x-javascript" \
"application/x-web-app-manifest+json" \
"application/xhtml+xml" \
"application/xml" \
"font/eot" \
"font/opentype" \
"image/bmp" \
"image/svg+xml" \
"image/vnd.microsoft.icon" \
"image/x-icon" \
"text/cache-manifest" \
"text/css" \
"text/html" \
"text/javascript" \
"text/plain" \
"text/vcard" \
"text/vnd.rim.location.xloc" \
"text/vtt" \
"text/x-component" \
"text/x-cross-domain-policy" \
"text/xml"
</IfModule>
# END DEFLATE COMPRESSION

You can check top 10 free website hosting and some free subdomain sites here: https://exceedcode.com/blog/free-web-hosting-and-domain-name-top-10-in-the-list/

optimize WordPress without any plugins.

Some bonus tips for WordPress Website:

1. Hide wordpress version

Hiding a WordPress version will make hackers difficult to find active vulnerabilities for your website. To hide it add following code in functions.php file in your theme folder or add it using any plugin (not recommended):

add_filter('the_generator', '__return_false'); //hide wordpress version

2. Disable login error hints

It makes bots or hackers very difficult to know if any of username or password is correct. Below code can hide it just place it in functions.php in your theme folder. “optimize WordPress without plugins”

function no_wordpress_errors(){
 return 'Please try the right user/pass combination';
}
add_filter( 'login_errors', 'no_wordpress_errors' ); //Disable login hints in wordpress

3. Update wordpress and plugins (php also)

Using up to date WordPress version and plugin help in WordPress website optimization without any other plugins. As new versions are more optimized than before, it also secures your website by eliminating new vulnerabilities. Also, update the PHP version in your hosting to a more recent stable version (try to set 1 version lesser than the more recent version but not a very low version).

Conclusion: Website speed matters a lot in building an online reputation and client transformation. Moreover, it is also required to have a Good speed when we need SEO. Above a few tweaks can improve your website’s page score easily, but there are more to be listed. For more info on how to optimize WordPress websites without plugins.

Topic: optimize (optimise) WordPress Website without plugins

Leave a Reply

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