Skip to content

Instantly share code, notes, and snippets.

@lloc
Last active December 11, 2015 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lloc/4524897 to your computer and use it in GitHub Desktop.
Save lloc/4524897 to your computer and use it in GitHub Desktop.
<?php
$name = 'scg_' . md5( $href );
if ( false === ( $value = get_transient( $name ) ) ) {
$response = wp_remote_get( $href );
if ( !is_wp_error( $response ) ) {
$value = trim( $response['body'] );
if ( !empty( $value ) )
set_transient( $name, $value, 86400 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment