With unlimited information becoming available with the click of a mouse, internet users have lost their patience, when it comes to waiting for a WordPress blog to load. If a page is taking too long to become legible, most internet users will move on to the next page that offers similar information, news, views, images or whatever else they are seeking. Therefore, if you want to capture your audience long enough for them to read what you have to say, you need to not only make sure that your blog is attractive to look at but that it loads quickly, before you lose a prospective reader.
The good news is that there are some easy tips and tricks that you can use to maximize the speed of your WordPress blog. Let me take you through a tour of the 10 best ways to speed up your blog. Some of these tricks are so simple that they might seem obvious to some of you but all of them work brilliantly when it comes to reducing the page load time.
1. Cache Fully Generated Pages
The reason why WordPress is slow is that it is a PHP script, which means that the page is dynamic and WordPress needs to execute all queries before the page can load. The best way to get around this problem is to use static pages. All you need to do is install a plugin called WP Super Cache, which will cache the fully generated pages that can be brought up quickly by users rather than waiting for dynamic queries to be processed. As soon as you install this plugin, you will find a noticeable decline in the load time of page, as well as more efficient usage of server resources.2. Disable Hotlinking
Hotlinking is basically bandwidth theft, where other sites create direct links from their articles to the images on your page, slowing down your server load time. One person doing this doesn’t really matter. But the reality is that hordes of spammers hotlink and copy your write-ups and images. Even the best web hosting service will be adversely affected by this. Rather than looking for a cure, what you need to do is prevent hotlinking from being attempted in the first place.One way that you can do this is by placing a code in your root .htaccess file.
The code you need to place is as follows:
#disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?wpbeginner.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds2.feedburner.com/wpbeginner [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
3. Create Smaller WordPress Pages
Even if you intend to create a huge resource of information that also includes many images, it is best to split up a long post into smaller pages with a few images. This way you will be able to increase your page views and get people to read long enough to want to know more. All you need to do is to use the WordPress admin panel to add the <!—nextpage> code at the end of each split page. Also, ensure that your template functions properly.4. Use Excerpts on the Main Blog Page
Okay, I am not a big fans of the usage of Excerpts in WordPress but without doubt it is a good way to speed up WordPress blog – especially if you are featuring several loooooooooong blogposts at your index page. Rather than showing full posts on the main page itself and burdening this page, you can display excerpts of up to 10 posts on the main blog page. For this, you need to visit the index.php and set a limit to the number of pages displayed through the WorldPress admin panel under the tab of Settings > Reading. You can do this in the following way:Go to index.php and find:
<?php the_content(__(‘(more…)’)); ?>Replace this code with:
<?php the_excerpt(__(‘(more…)’)); ?>Limit the number of posts displayed via the tabs Settings > Reading in the admin panel:
5. Optimize the MySQL Database
You can either do this manually or by using a plugin. In the manual method, you will need to access phpMyAdmin and choose your database. There will be an option for you to select the tables and optimize them. On the other hand, you could use a plugin called Optimize DB by Joost De Valk. This plugin will do exactly the same thing as you would have done manually but will minimal effort on your part.6. Minimize external websites and scripts
You can avoid the use of external scripts, both directly and through plugins. Some plugins can take a long time to load and often lead to your page not loading properly, especially during times of heavy traffic. Also, displaying widgets on your sidebar will only slow down your site.7. Use Expires Header for Static Resources
This header helps you specify the time period for which a visitor will be able to bring up specific static content, including CSS files, images, javascript, etc.) and thereby cut down on load time. Use the following code in your root .htaccess file:ExpiresActive OnHere, the figure 2628000 represents the number of seconds in a month. You can change this figure to any time frame of your choice.
ExpiresByType image/gif A2628000
ExpiresByType image/png A2628000
ExpiresByType image/jpg A2628000
ExpiresByType image/jpeg A2628000
8. Remove All Unwanted plugins and PHP tags
If your page is using more than 15 plugins, look for those that can be directly integrated into your theme. At the same time, check whether you actually need those plugins or whether you can do without them. Also, look at your header.php and other theme files to check for php tags. You will find numerous redundant tags or unnecessary queries that can be removed without harming your site.9. Compress All Java Script files
Regardless of the size of these files, if they are repeatedly loaded, they will use up huge server resources and increase load time. Various compressors are available online that will help you save on resources and speed up your WordPress blog.10. Minimize Database Calls
Database calls are what make WordPress dynamic. Although having a dynamic page is at times unavoidable, replacing database calls with simple text can significantly decrease WordPress load time.For instance, if your header.php code looks like this:
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>This means that useless database queries are being called up. These can easily be put in simple text form, like this:
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo(‘html_type’); ?>;
charset=<?php bloginfo(‘charset’); ?>" />
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">Some other ways in which you can bring down the number of database calls including having a static stylesheet URL, having a static pingback URL, having a static feed URL, as well as removing the WordPress version of the blog.
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
No comments:
Post a Comment