Skip to content

Instantly share code, notes, and snippets.

@jimboobrien
Forked from wpscholar/hidden-theme.php
Created September 20, 2017 22:41
Show Gist options
  • Save jimboobrien/425a4015f13c2d2fd8952a5420d7ccf1 to your computer and use it in GitHub Desktop.
Save jimboobrien/425a4015f13c2d2fd8952a5420d7ccf1 to your computer and use it in GitHub Desktop.
<?php
/**
* Ensure that a specific theme is never updated. This works by removing the
* theme from the list of available updates.
*/
add_filter( 'http_request_args', function ( $response, $url ) {
if ( 0 === strpos( $url, 'https://api.wordpress.org/themes/update-check' ) ) {
$themes = json_decode( $response['body']['themes'] );
unset( $themes->themes->{get_option( 'template' )} );
unset( $themes->themes->{get_option( 'stylesheet' )} );
$response['body']['themes'] = json_encode( $themes );
}
return $response;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment