Created
September 2, 2012 21:05
-
-
Save jaredatch/3604536 to your computer and use it in GitHub Desktop.
Prevent WordPress theme update prompt
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
<?php | |
/** | |
* Don't Update Theme | |
* | |
* If there is a theme in the repo with the same name, | |
* this prevents WP from prompting an update. | |
* | |
* @author Mark Jaquith | |
* @link http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/ | |
* @since 1.0.0 | |
*/ | |
function ja_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', 'ja_prevent_theme_update', 5, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment