Skip to content

Instantly share code, notes, and snippets.

@carmichaelize
Last active August 29, 2015 14:00
Show Gist options
  • Save carmichaelize/11078011 to your computer and use it in GitHub Desktop.
Save carmichaelize/11078011 to your computer and use it in GitHub Desktop.
Wordpress Transients & API Calls
<?php
//Get transient data
$data = get_transient( 'data_key' );
//Check transient data exists
if(!$data){
//Query API
//Handle API Response
//Cache Response
if($data){
set_transient( 'data_key', $data, 60*60 );
}
}
//Render data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment