Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Created June 17, 2014 17:41
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save jaredatch/f406d6b2ca543cdb4898 to your computer and use it in GitHub Desktop.
Save jaredatch/f406d6b2ca543cdb4898 to your computer and use it in GitHub Desktop.
<?php
/**
* Dont Update the Theme
*
* If there is a theme in the repo with the same name, this prevents WP from prompting an update.
*
* @since 1.0.0
* @param array $r Existing request arguments
* @param string $url Request URL
* @return array Amended request arguments
*/
function ea_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', 'ea_dont_update_theme', 5, 2 );
Copy link

ghost commented Oct 27, 2015

Does this still work? I can't seem to get rid of that update message on my active theme.

@michael-sumner
Copy link

Does this still work? I can't seem to get rid of that update message on my active theme.

Check this article:
https://themetry.com/unwanted-theme-updates/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment