I notice that WordPress can use a lot of PHP_Memory and go over the limit a lot especially when rebuilding a sitemap, or when a lot of plug-ins and widgets are installed on a blog.
Being on cheap shared web hosting which only costs $5 dollars a month usually have a lot of limits like only 30MBs of PHP memory and not a lot of CPU resources to run WordPress like a virtual or dedicated web hosting plan.
Also, most shared web host companies will disable your website if it uses too much server resources like RAM, CPU, or bandwidth which can slow down other costumers accounts on the same web server which is sharing the server with your website.
In most cases, if you tried talking to your web hosts on raising your RAM limit for PHP memory or giving you more CPU power, they will tell you to upgrade your plan to the more expensive virtual private and dedicated web hosting plan which can range from $20-100+ dollars a month.
Plus, virtual private servers and dedicated servers can be harder to use compared to shared web hosting accounts in some cases. Shared hosting usually have easier to use control panels like 1and1 and GoDaddy shared hosting plans. With VPS, Manage VPS, or a dedicated server, you need to know how to use Cpanel or Plesk, and other web server related programs which are not as point and click compared to shared hosting accounts.
However, with simple changes on how you run and manage your WordPress blog, you can prevent WordPress from using too much CPU and memory resources which can make your blog slow, unstable or disabled by your web host company for using too much of their web servers resources.
These tips would also work for people on more expensive virtual private servers and dedicated web hosting servers.
1. Install Plug-ins and widgets which you “absolutely” need like Anti-spam, social bookmarking, Caching and security related plug-ins. Avoid installing plug-ins which use too much database or memory and CPU resources. Also, avoid using plug-ins which log or request data from your mySQL database. I found related posts, broken link checker, most commented posts, most popular posts, counters, and most recent posts can use a lot of database resources.
2. Install an WordPress Caching plug-in and make sure to enable database caching, so there are fewer database queries and request which can use up a lot of web server resources on a high traffic blog. I like to use W3 Total Cache for my caching needs since it also turns on Gzip compression for WordPress which can save you a lot of bandwidth and web server resources.
Use WP-Optimize Plug-in to remove unwanted revisions, and optimize your database tables.
3. Compress/save your images to a lower quality with an image editor like Irfanview and use fewer images on your blog. Also, I recommend using Jpeg file format for photos, and png and gif file format for clip art graphics.
If you have a background image for your blog, consider compressing/saving the image with a lower quality setting, using a tile background which tiles to form a big image. Having no image and using a solid color can speed up your blog a bit too since no image needs to be loaded when your blog is loaded.
5.(More Advance steps) Don’t use Text widgets in Appearance>Widgets. Hard code your widgets and HTML links into your template file like header.php, sidebar.php, footer.php
6. Use Google Adsense Custom Search or the non-Adsense version of Google Custom Search instead of the default WordPress Blog search engine in your sidebar.php or header.php file for your template.
7. Use the More/Teaser button, so users need to click on your title link or the “Read more link” to read your entire post. this will help make your database not work as hard, and make your homepage load faster.
8. Regularly optimize and repair your WordPress Database file. Make sure to back up your database before you repair or optimize your database in PhpMyAdmin.
9. Hard code the title and description of your blog in the header.php, Sidebar.php, footer.php file instead of making php database calls or widgets and plugins. (BACK UP your theme files before you begin) [This is an advance step, and you can seriously break your theme if you are not careful or do not what you are doing.]
10. Make sure all your HTML in your template file and CSS style-sheet code file is free of errors or unnecessary tags, and avoid using tables and frames in your templates. You can use validator.w3.org to validate your HTML code. Sometimes it is difficult to make all your code valid because your plug-in files have in-valid code.
11. In the Settings > reading section change blog pages show at most and feed to 3-4 posts. Also, make the feed only show summaries of your posts.
12. In Settings > Discussions> turn off E-mail me when anyone posts a comment, or when a comment is posted.
13. In Settings> Media> you can set all the sizes to 0 to disable making multiple size of the same image which can really use up a lot of disk space over time.
14. Consider changing hosting companies which has faster and more reliable web hosting servers for shared hosting. If you have the cash and the knowledge of running more advance hosting plans then shared hosting consider switching to a managed or un-managed virtual private server, dedicated web hosting plan.
Some of the bigger web hosts tend to stuff a lot of costumers on one shared hosting server which can make your website slow even if you did all the tips I talk about.
16. Host your videos on YouTube, and your photos on Amazon S3 or another web server.
17. Change to a more lightweight theme like the default TwentyTen Theme for WordPress, and edit the theme files to remove stuff you do not need, but make sure to backup your theme files first.
18. Use the latest version of MySQL and php which your web hosting server can support like MySQL 5 and PHP5
19. Test your website speed with varies free online tools like tools.pingdom.com. After doing all these changes I listed above my average load time is under 4 seconds for this blog according to Pingdom. If I’m lucky or during non-peak times my blog load under 3 seconds which is pretty good for “$60 a year” hosting with no CDN media host to speed up loading of my files.
20. Consider using fewer images, embedded videos and music players in your blog posts and pages.
21. Write shorter posts if your post is 2000 words or more, or turn your long post into multiple small to average size post with 500-700 words.
22. Keep WordPress and all its Plug-ins updated to make sure your using the latest version which usually have bug fixes, and performance tweaks.