Created
January 27, 2015 20:13
-
-
Save jester1979/584c0951ec1b673df1a1 to your computer and use it in GitHub Desktop.
Don't update theme
This file contains hidden or 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
add_filter( 'http_request_args', 'dont_update_theme', 5, 2 ); | |
/** | |
* 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, request arguments | |
* @param string $url, request url | |
* @return array request arguments | |
*/ | |
function dont_update_theme( $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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment