How to purge all transient caches?

Not tested, but if you need a quick and dirty way, you could put a script like this in your WordPress folder and call it each time: define( ‘WP_USE_THEMES’, false ); require(‘wp-blog-header.php’); global $wpdb; $wpdb->query( “DELETE FROM $wpdb->options WHERE option_name LIKE ‘%\_transient\_%'” ); Not to be used on a production server.

Set Session Time Limit for Password Protected Posts

The reason is when you execute this code setcookie(‘wp-postpass_’ . COOKIEHASH, ”, 0, COOKIEPATH); It will reset your post password cookie to blank ”, so it just work once To solve this you need to assign the original cookie and extend the timeout, like this setcookie(‘wp-postpass_’ . COOKIEHASH, $_COOKIE[‘wp-postpass_’ . COOKIEHASH], time() + 60 * … Read more

How to archive a wordpress site (make it read only)

Assuming you have shell access, or access to any Linux/Unix box, you could use wget to download the entire site to static html files: wget –recursive –no-clobber –page-requisites –html-extension –domains domain.com http://domain.com Then either upload or move these files to your web root (after backing up and removing your WP installation). I imagine it’s also … Read more

Stylesheet switching and caching

I use W3TC, so these are approaches that I can come up with it for it: Fragment caching to exclude that part of page, will reduce cache effectiveness overall. Identify page with switched stylesheet by query argument, disable caching of such pages. Identify page with switched stylesheet by URL endpoint, disable caching of such by … Read more

WordPress transients for a shortcode

Use this instead of the line in wich you define $days (your second line): $transient = get_transient( ‘your_transient_key’ ); if( !$transient ): $days = file_get_contents( ‘json_file’ ); set_transient( ‘your_transient_key’, $days, DAY_IN_SECONDS*7 ); else: $days = $transient; endif; $days = json_decode( $days ); … May be a bit rough but you get the idea.