Last active
August 29, 2015 14:20
-
-
Save alexandrascript/1aa752722956eb72ea9d to your computer and use it in GitHub Desktop.
WP Transients - Get Transient Data
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
// Get any existing copy of our transient data | |
if ( false === ( $special_query_results = get_transient( 'special_query_results' ) ) ) { | |
// It wasn't there, so regenerate the data and save the transient | |
$special_query_results = new WP_Query( 'cat=5&order=random&tag=tech&post_meta_key=thumbnail' ); | |
set_transient( 'special_query_results', $special_query_results, 12 * HOUR_IN_SECONDS ); | |
} | |
// Use the data like you would have normally... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment