jimboobrien
9/20/2017 - 10:42 PM

hidden-plugin.php

<?php

/**
 * Ensure that a specific plugin is never updated. This works by removing the
 * plugin from the list of available updates.
 */
add_filter( 'http_request_args', function ( $response, $url ) {

	if ( 0 === strpos( $url, 'https://api.wordpress.org/plugins/update-check' ) ) {
		$basename = plugin_basename( __FILE__ );
		$plugins  = json_decode( $response['body']['plugins'] );
		unset( $plugins->plugins->$basename );
		unset( $plugins->active[ array_search( $basename, $plugins->active ) ] );
		$response['body']['plugins'] = json_encode( $plugins );
	}

	return $response;
}, 10, 2 );