Last active
July 17, 2017 06:05
-
-
Save ernilambar/abf3b77c3a0f5599d7ab to your computer and use it in GitHub Desktop.
WordPress Transient Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function example_transient(){ | |
$transient_key = 'my_unique_transient_key'; | |
$transient_period = 24 * HOUR_IN_SECONDS; | |
$output = get_transient( $transient_key ); | |
if ( false === $output ) { | |
$output = 'Hello World'; | |
set_transient( $transient_key, $output, $transient_period ); | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment