Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created October 28, 2013 20:22
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save billerickson/7203907 to your computer and use it in GitHub Desktop.
Save billerickson/7203907 to your computer and use it in GitHub Desktop.
<?php
/**
* Don't Update Plugin
*
* This prevents you being prompted to update if there's a public plugin
* with the same name.
*
* @since 1.0.0
* @author Mark Jaquith
* @link http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/
* @param array $r, request arguments
* @param string $url, request url
* @return array request arguments
*/
function ea_core_functionality_hidden( $r, $url ) {
if ( 0 !== strpos( $url, 'http://api.wordpress.org/plugins/update-check' ) )
return $r; // Not a plugin update request. Bail immediately.
$plugins = unserialize( $r['body']['plugins'] );
unset( $plugins->plugins[ plugin_basename( __FILE__ ) ] );
unset( $plugins->active[ array_search( plugin_basename( __FILE__ ), $plugins->active ) ] );
$r['body']['plugins'] = serialize( $plugins );
return $r;
}
add_filter( 'http_request_args', 'ea_core_functionality_hidden', 5, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment