Skip to content

Instantly share code, notes, and snippets.

@wpscholar
Created August 19, 2015 04:30
Show Gist options
  • Save wpscholar/751a0d802c591a5b331b to your computer and use it in GitHub Desktop.
Save wpscholar/751a0d802c591a5b331b 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