Created
May 30, 2018 15:15
-
-
Save CapWebSolutions/fd6ab677bd7755b7b6667f71708374d0 to your computer and use it in GitHub Desktop.
Do not check for plugin or theme update. Include in core functionality plugin.
This file contains hidden or 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
| /** | |
| * Don't Update Plugin | |
| * | |
| * @since 1.0.0 | |
| * | |
| * This prevents you being prompted to update if there's a public plugin | |
| * with the same name. | |
| * | |
| * @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 cws_hidden_plugin( $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', 'cws_hidden_plugin', 5, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment