PHP WordPress - Set Transient Cache Data

<?php $transient_key = 'your_cache_key'; $render = get_transient( $transient_key ); if ( ! $render ) { ob_start(); ?><div>This is cached content</div><?php $expiration = DAY_IN_SECONDS; // Use 0 for never expires & autoload $render = set_transient( $transient_key, ob_get_clean(), $expiration ); } echo $render;

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.