WordPress’ compatibility with a wide array of operating systems has made it a globally popular content management system (CMS). Specially talking about the Linux operating system, if your WP site/blog is running on Linux, then this is a post, which will serve as your handy guide in speeding up your portal. Here, you’ll find a collection of simple-to-follow tips on speeding up the WordPress CMS for your site/blog operating on the popular Linux operating system. So, let me cover these tips one by one.
- Opt for Caching In WordPress Itself
In order to cache in WordPress, you simply need to enable the WordPress built-in object-caching feature in wp-config.php as shown below:
[php]
/* Cache */
define ( ‘WP_CACHE’, true );
[/php]
Moreover, you can also opt for installing an Object Cache module along with a user object cache PHP Module. For example, you can use APC Object Cache Backend if you have APC or APCu installed in your WordPress website/blog.
- Disable Hotlinking
Also known as bandwidth theft, hotlinking is something, which must be thoroughly disabled for your WordPress site/blog. Irrespective of how efficient your web host is, it will definitely be slowed down if the hotlinking is not being prevented. There are some remarkable ways of disabling hotlinking for your WordPress site/blog. One of the best techniques is through the root .htaccess file where you simply need to add the following code:
[php]
#disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?wpchats.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds.feedburner.com/wpchats [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
[/php]
- Opt for Splitting Long Posts Into Several Pages
If you’re looking ahead to create a mega resource, which expects you to list around 100+ resources with 100+ images within the post, it is recommended to split the respective post into multiple pages. Doing this will pace up the WordPress CMS for your blog, make the web pages load faster and increase the overall page views. You can easily split the long posts using the WordPress admin panel. All you need to do is simply enter the below code in your theme’s functions.php file:
[php]
<!–nextpage–>
[/php]
- Optimize the MySQL database
By optimizing MySQL database for your WordPress website/blog you can greatly increase the overall load time. You can do this with in either of the two ways explained below:
- Go to phpMyAdmin and select the MySQL database. After this, scroll towards the bottom, click the “check all” box to select all tables for the respective database and finally move towards the center of the screen where there is a dropdown menu. Within this menu, click on the “optimize tables” option as shown in below screen-shot
- If you are not inclined on using the manual approach for optimizing the SQL database (the one explained above), you can use a popular plugin called Optimize DB, which will do exactly everything that has been mentioned above, thereby saving you from the hassles of messing up with phpMyAdmin.
- Load Files Only On Pages That Actually Need It
If some of your pages within the WordPress site/blog don’t require a file or specific code to work, there’s no point loading them. Fortunately, WordPress allows you to show selective code with the help of conditional tags. For example, you may have witnessed the use of jQuery cycle plugin with the slideshows that are visible on the site/blog’s homepages. In order to ensure that this plugin loads only when the visitor goes to the homepage, you need to use the code as shown below:
[php]
<?php if ( is_front_page() ) { ?>
<script src="<?php bloginfo(‘template_url’); ?>/js/cycle.js"></script>
<script>
$(document).ready(function() {
$(‘#slideshow’).cycle({
fx: ‘fade’
});
});
</script>
<?php } ?>
[/php]
- Opt for Google’s Content Delivery Network For Delivering Jquery
Since WordPress doesn’t use any CDN (Content Delivery Network) by default, it is recommended to opt for Google’s CDN for serving the jQuery library across web pages on your website. It is with the incorporation of a renowned CND, that visitors can be saved from getting into the complications of loading unnecessary additional files. So, in order to use Google CDN for the jQuery library, simply add the below code in your site’s functions.php file:
[php]
if( !is_admin()){
wp_deregister_script(‘jquery’);
wp_register_script(‘jquery’, ("https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"), false, ‘1.6.4’);
wp_enqueue_script(‘jquery’);
}
[/php]
Wrapping Up
So these were some of the most popular tricks on speeding up WordPress CMS in the simplest manner. If you know of any other trick that hasn’t been mentioned here, please don’t hesitate in sharing the details for the same using the comments box displayed below.