Hot answers tagged

31

Hi @googletorp: Clearly nothing scales as well as static files served by a fast web server and any CMS that has to figure out what to load and then load it will not perform as well, WordPress or otherwise. One of the issues is the number of database queries required per URL request and my 2 prior years experience working exclusively with Drupal and now 2+ ...


26

You could install WordPress on Nginx. There are a number of resources to help: nginx Compatibility plugin HOWTO: Install WordPress On Nginx- Slicehost discussion How To Speed Up WordPress With Nginx And WP Super Cache WordPress on nginx + lighttpd + FastCGI + php Nginx as a front-end proxy cache for WordPress Some performance information from that last ...


24

On shared hosting plans your caching options are limited. You will only be able to statically cache the html output from your pages. This is the fastest way to serve pages but you loose the dynamic aspects of WordPress like making comments and seeing the latest comments on posts. There are disk caching options available for objects and database but unless ...


23

Add the filemtime() of your stylesheet as version parameter. Lets say, your default stylesheet is in css/default.css and css/default.min.css (not style.css). When we register a stylesheet on wp_loaded (not init), we can pass a version as fourth parameter. That will be the last modified time and therefore change every time we change the file. $min = ...


22

Set client-side expiries for things like css, images, JavaScript etc which don't need to be redownloaded for each page view. This, by far, made the biggest difference to my site loading times. The fastest download is the download that never happened ... # BEGIN Expire headers <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus ...


19

Minimize the number of plugins you run to only what you really need. Especially be aware of plugins that add javascript and CSS code on every page load, even when that code isn't being used on the page. If you are creating your own theme from scratch, break your CSS down so that features that are only need for particular page templates or view types ...


16

My WordPress Performance and Caching Stack This is the best WordPress performance stack for a low to mid range single server or VPS. I am classifying mid range as single core with around 1G of memory and fairly fast drives. Server Stack Linux - Either Debian Lenny or Ubuntu Nginx - Configured as reverse proxy static file cache Apache - Apache will ...


14

Should I use Transient API at all here? No. In a stock WordPress install transients are stored in the wp_options table, and only cleaned up during core upgrades. Suppose you have 50,000 posts, that's 50,000 additional rows in the options table. Obviously they're set to autoload=no, so it's not going to consume all your memory, but there's another ...


13

You don't have to use @import. It's best not to, actually. Using an enqueued approach is probably better all around. Here's the relevant part of twentythirteen's code: function twentythirteen_scripts_styles() { ... // Loads our main stylesheet. wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18' ); ... } ...


13

if you want to flush the cache you can do that: the plugin has functions for that <?php flush_pgcache() //page cache flush_dbcache() // database cache flush_minify() // minify cache flush_all() //all caches ?> and you just need to call it like this: <?php $w3_plugin_totalcache->flush_all(); ?> and that is basically the answer ...


11

Run memcached and use an object cache to reduce the number of database queries. This caches data from the database, rather than pages. Not sure if w3-total-cache already does this. Make sure you are running an opcode cache like APC. (There are several more available.)


11

Object cache everywhere WordPress tries to reduce the number of database queries as much as possible. For example, anytime you get a meta field or a taxonomy field, before querying the database, WordPress looks if that that was already queried and stored in cache, and returns it from there instead of querying the database. The "cache job" is done via ...


10

W3 Total Cache supports fragment caching. From FAQ: How do I implement fragment caching? Edit your templates to with the following syntax to ensure that dynamic features remain so: Example 1: <!-- mfunc any PHP code --><!-- /mfunc --> Example 2: <!-- mfunc -->any PHP code<!-- /mfunc --> Example 3: <!--MFUNC --> ...


9

Hm, I am not sure but I think that whole cache should be invalidated on publishing of new post... Had you tried to enable debug info in W3TC and check why are those pages aren't refreshed? As for manual cache clear, from plugin's FAQ: How can I flush the cache without using the WP Admin interface? It's possible to empty the entire cache or ...


9

Not All WP Code Is Public Code If you are going to release something public, then all the things kovshenin said are perfectly valid. Things are different if you are going to write private code for yourself or your company. External Object Cache Is A Big Benefit, In Any Case To set a external persistent object cache is very recommended, when you can. All ...


8

In addition to using a disk caching plugin like wp-cache, put your blog on a host volume that has the "noatime" property set on it. Otherwise, SSH into your host (if your webhost provides that) and routinely run this command on your files every few days: chattr -R +A ~/* The ~/* means "my files under my home directory". You can change that path as you ...


8

It has this natively: Performance > Page Cache > General > Don't cache pages for logged in users You can always check if you are seeing cached page by looking at page source, W3 outputs status (commented out) at end of page.


7

@Tal, Generally speaking you should only be using one caching plugin. WP Super Cache, W3 Total Cache, Hyper Cache and DB Cache Reloaded all drop files directly in your wp-content directory and they would conflict with each other and cause errors if you were using more than one. I would recommend using W3 Total Cache because it gives you the option of ...


7

A few answers off the top of my head: 1) Minimize the number of HTTP requests the browser has to make to your host by concatenating JavaScript and CSS where possible/practical. 2) Offload as much of your image/media serving to 3rd party CDNs as possible, particularly if you're using shared hosting. 3) Try reducing the number of posts you're displaying on ...


7

I remove version like this, can be easily written out to match multiple domains: add_filter( 'script_loader_src', 'jquery_unversion' ); function jquery_unversion( $src ) { if( strpos( $src, 'ajax.googleapis.com' ) ) $src = remove_query_arg( 'ver', $src ); return $src; }


7

The mix up is usually because these extensions are about two unrelated technologies: opcode caching and key-value data store. For WordPress you prefereably want both. Opcode caching is really the "normal" way to run PHP (and lack of it is essentially crippled shared hosting way). Data store can *(and should) be used by WordPress object cache plugins for ...


6

You are loading the rtl.css using the WordPress automatic way, that is, having a rtl.css in the theme folder will be loaded by WordPress automatically if it presents and direction of current language ir rtl (you should add this information to the question, it has been difficult to figure it out how you are loading the file). This process defines ...


6

I would recommend W3 Total Cache. It optimizes over several different aspects of the site (HTML, database, etc.) and I haven't ran into any issues with it.


6

Static page cache is trade-off of resources for speed. The larger and more complex site is, the more resources it takes to cache it. Since there is no such thing as unwanted speed, static cache of small sized site is one of the best performance improvements possible. Especially on shared hosting where other tweaking options are very limited. CDN for ...


6

The most common thing to try is a content caching plugin like W3 Total Cache or WP Super Cache. Both will cache entire pages to disk, and will allow the Apache web server to completely bypass PHP processing for many page views. With W3 Total Cache, you can also cache system objects and the results of database queries, as well as using a CDN (Content ...


6

There is a hook for that: 'mce_css'. It is called in _WP_Editors::editor_settings() and you get all loaded stylesheets comma separated as the first and only parameter. Now it is easy: Use the global variable $editor_styles (here are your theme’s and parent theme’s editor stylesheets stored already), add the time of the file’s last modification as a ...


5

Souljacker, I would first take a look at your plugins. Star Ratings for Reviews hasn't been updated for over 3 years and looks like its real heavy on the db. I saw some raw sql with some INNER JOINS that look troublesome. On the server side you should implement some object caching. APC is the defacto standard and will give you the best results. Once ...


5

This might seem overly simple, but how about just disabling caching until you're done with the development portion of your site? It's more than simple to turn on and off.


5

Bainternet's solution didn't seem to work for me. I'm successfully using this alternative snippet within a plugin, loaded at the admin_init action: // Clear all W3 Total Cache if( class_exists('W3_Plugin_TotalCacheAdmin') ) { $plugin_totalcacheadmin = & w3_instance('W3_Plugin_TotalCacheAdmin'); $plugin_totalcacheadmin->flush_all(); ...


5

Use a database class that is trimmed for optimization. We made good experiences with own code to reduce memory usage and database access speed. Next to that, you can optimize the database structure itself by some small changes that do a lot as well. Part of the database class code can be found in the wordpress trac, it did not made it into core (Ticket ...



Only top voted, non community-wiki answers of a minimum length are eligible