Created
November 14, 2013 15:27
-
-
Save ramseyp/7468738 to your computer and use it in GitHub Desktop.
Simple code useful if you don't want a WordPress plugin to show an update notice.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Keep your plugin from updating | |
* http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/ | |
*/ | |
function s25_plugin_no_update( $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', 's25_plugin_no_update', 5, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment