Skip to content

Instantly share code, notes, and snippets.

@mindctrl
Forked from mustardBees/plugin-file.php
Created February 21, 2014 02:58
Show Gist options
  • Save mindctrl/9127991 to your computer and use it in GitHub Desktop.
Save mindctrl/9127991 to your computer and use it in GitHub Desktop.
<?php
/**
* Don't update this plugin
*
* This prevents you from being prompted to update if there's a public plugin
* with the same name.
*
* @author Phil Wylie
* @link http://link.from.pw/1cFfcFZ
* @param array $r Request arguments
* @param string $url Request url
* @return array Request arguments
*/
function pw_hidden_plugin( $r, $url ) {
if ( 0 === strpos( $url, 'https://api.wordpress.org/plugins/update-check/1.1/' ) ) {
$plugins = json_decode( $r['body']['plugins'], true );
unset( $plugins['plugins'][plugin_basename( __FILE__ )] );
$r['body']['plugins'] = json_encode( $plugins );
}
return $r;
}
add_filter( 'http_request_args', 'pw_hidden_plugin', 5, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment