16 Ultimate Ways To Speed Up Your WordPress Website – Page 5
Fix #11 – Clean Up the Database– WP Optimize is a plugin which helps you by cleaning and minimizing your WordPress database. You can optimize your MySQL database, empty the trash, remove post revisions, delete spam comments, remove pingbacks and trackbacks with one simple click of the mouse. This can greatly improve speed, especially when your database loads often. Use this plugin with caution. Be careful to not clean/delete things you aren’t completely sure about. Prior to making any changes to your database always back up first.
Fix #12 – Replace PHP With Static HTML– A more advanced fix allowing for additional speed improvements. You can remove unnecessary PHP executions and database access saving server resources by replacing PHP with static HTML. Many WordPress themes are loaded with PHP code in them to allow them to be easily installed on any website. It can have a noticeable effect on your site performance. You can customize the theme to remove unnecessary PHP executions
This generic PHP code can be replaced with some static HTML in order to save CPU processing time and database queries, and under load this can make a big performance difference.
The way to fix this is quite simple. If you examine your theme’s Header.php file in your Appearance > Editor tab in WordsPress you will find some lines that look somewhat like the following:
<head> <meta charset="<?php bloginfo('charset'); ?>"> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> <link rel="shorcut icon" type="image/x-ico" href="<?php bloginfo('template_url'); ?>/favicon.jpg" /> <title><?php wp_title( '-', true, 'right' ); ?></title> <?php wp_head(); ?> </head>
Now, if you take a look at the bold segments, that is the PHP code you will be replacing with your information. In this example, there are 4 different PHP commands which need to be executed every time the page loads. These PHP commands pull this information from the database based on what you entered into the blog’s options menu. Since we can personalize the theme with your information we can eliminate those 4 PHP executions.
To do so, load your blog in a browser window and select “View Source”. You should then see the finished code that had the PHP processed and replaced. In the case of this example, the following was the finished result:
<head> <meta charset="UTF-8"> <link rel="pingback" href="http://wheresmydrink.com/xmlrpc.php"> <link rel="shortcut icon" href="http://wheresmydrink.com/wp-content/uploads/2015/01/favicon.ico" /> <title>Where's My Drink | Crafting and Customizing your life</title> <?php wp_head(); ?> </head>
Now, all we need to do is replace the original PHP code with the already processed code into your Header.php file. Now save the updated Header.php and that’s it! You’ve saved yourself 4 PHP executions. You can also look in the Footer.php file too because there is often content there that can be converted as well. One other area to examine is the themes sidebar(s). For example, do you have a fixed number of categories that hasn’t changed in a year? Why not remove the PHP used to generate those and replace them with a static HTML list instead?
Let’s focus a moment on social plugins along with RSS subscription icon plugins. You should consider replacing those bloated plugins with static HTML subscription links. Again, you can simply take a look at the source code on your page to see the final HTML to use. This will eliminate the need to execute PHP commands on every page load to have these show.
Don’t stop there. The general rule of thumb is, if the content always displays the same, it should be converted to HTML since PHP is not needed. If you take all of this advice you should be able to remove 5-10 PHP commands from processing with every single page load. It can have a noticeable effect on your site performance.
Continue Reading 16 Ultimate Ways To Speed Up Your WordPress Website