Skip to content

Instantly share code, notes, and snippets.

@jb510
Created April 6, 2014 00:10
Show Gist options
  • Save jb510/9999721 to your computer and use it in GitHub Desktop.
Save jb510/9999721 to your computer and use it in GitHub Desktop.
Don't Update Theme WordPress API 1.1
/**
* Don't Update Theme.
*
* If there is a theme in the repo with the same name, this prevents WP from prompting an update.
*
* @since 1.0.0
* @author Mark Jaquith
* @link http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/
* @param array $r Existing request arguments
* @param string $url Request URL
* @return array Amended request arguments
*/
function jb_dont_update_theme( $r, $url ) {
if ( 0 !== strpos( $url, 'https://api.wordpress.org/themes/update-check/1.1/' ) )
return $r; // Not a theme update request. Bail immediately.
$themes = json_decode( $r['body']['themes'] );
$child = get_option( 'stylesheet' );
unset( $themes->themes->$child );
$r['body']['themes'] = json_encode( $themes );
return $r;
}
add_filter( 'http_request_args', 'jb_dont_update_theme', 5, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment