Should I enable FastCGI on WordPress?

For data that’s been cached, the two caches should perform equivalent. In general, most folks will find that WP-Supercache is easier to setup and use from an admin perspective (purging & pre-populating). People cache for two reasons: 1) Improved concurrency at handling many visitors simultaneously. This is only relevant to high-traffic sites. For this, both … Read more

Transient caching for wp query

For my WordPress testimonials widget plugin I’ve successfully used transients with expiration dates to drop page loads by 0.1 to 0.5 seconds. Using WordPress’s own transients is a life-saver. It’s so much easier to package or use straight as needed and then concentrate again on application logic. Rolling yet another caching system is useless. Further, … Read more

Check if a user is connected and get is ID without fully loading wordpress

WordPress stores user_name of logged in user in auth cookie. Auth cookie is signed, so it’s easy to check if it’s fake, so you can trust this info. OK, so how to get user’s user_name from cookie? There is function for that 😉 wp_parse_auth_cookie and this is what it returns: return compact( ‘username’, ‘expiration’, ‘token’, … Read more

Difference between fragment caching and wp_cache

I’ll post this as an answer, even though I don’t know much about caching. If you read about WP Object Cache it says: By default, the object cache is non-persistent. This means that data stored in the cache resides in memory only and only for the duration of the request. Cached data will not be … Read more

How to prevent queried posts from being added to cache?

The posts array result in WP_Query is mapped to get_post() (here and here) with: $this->posts = array_map( ‘get_post’, $this->posts ); and that seems to be adding posts to the object cache even though the cache_results argument is set to false in WP_Query. Within the get_post() function (here) we have: $_post = WP_Post::get_instance( $post ); for … Read more

How to clear WordPress Cache from Server/FTP/Remote location

WordPress has no native page source output caching. In vanilla installation changes to templates should show up immediately. If that doesn’t happen there are several possible reasons: there is static page cache plugin installed, which serves stale version (the specific implementation of cache would depend on a plugin); there is a caching layer between the … Read more

Possible to configure nginx to ignore cache for logged in users in certain roles only?

Here is what I ended up doing: // Set disable cache for certain roles add_action(‘init’, ‘add_custom_cookie_admin’); function add_custom_cookie_admin() { if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); $thisrole = $current_user->roles[0]; if($thisrole !== ‘subscriber’) { setcookie(“disable_cache”, $current_user->user_login, time()+43200, COOKIEPATH, COOKIE_DOMAIN); } } } // and then remove the cookie on logout function clear_custom_cookie_on_logout() { unset($_COOKIE[“disable_cache”]); setcookie( … Read more

W3 total Cache – Site with query strings

W3TC “Accepted query strings:” makes listed query strings ignorable: https://github.com/szepeviktor/w3-total-cache-fixed/pull/380 My current list is: utm_source utm_medium gclid This way these pages: /page /page?utm_source=blabla&utm_medium=email /page?glcid=y349untg93h45t are served from page enhanced cache as for /page

Plugin a specific cache functionality?

Most of WordPress caching functionality is set up with text (serialized if needed) in mind. Since you need to store binary data it is probably better to maintain own cache. As for location of cache I think it depends: for single personal installation I would pick directory that is short and makes nice URL, for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)