Skip to content

Instantly share code, notes, and snippets.

@wpspeak
Created September 29, 2013 16:34
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 wpspeak/6754081 to your computer and use it in GitHub Desktop.
Save wpspeak/6754081 to your computer and use it in GitHub Desktop.
Disable WordPress theme update checks
<?php
/**
* Disable WordPress theme update checks
* If there is a theme in the repo with the same name,
* this prevents WP from prompting an update.
*
* @link http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/
* @author Mark Jaquith
* @since 1.0.0
*
**/
function afn_prevent_theme_update( $r, $url ) {
if ( 0 !== strpos( $url, 'http://api.wordpress.org/themes/update-check' ) )
return $r; // Not a theme update request. Bail immediately.
$themes = unserialize( $r['body']['themes'] );
unset( $themes[ get_option( 'template' ) ] );
unset( $themes[ get_option( 'stylesheet' ) ] );
$r['body']['themes'] = serialize( $themes );
return $r;
}
add_filter( 'http_request_args', 'afn_prevent_theme_update', 5, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment