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

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

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

Should the page cache be refreshed often? [closed]

The one possibility is caching broken page. For example some database query fails (which is not uncommon in shared environment and/or under load) and some page gets displayed broken / with errors. Since caching doesn’t assume integrity checking it can cache such page… And your cache interval is days – page is broken as long. … Read more