Skip to content

Instantly share code, notes, and snippets.

@grok
Created April 10, 2015 21:04
Show Gist options
  • Select an option

  • Save grok/d4c2044e95cc761d685d to your computer and use it in GitHub Desktop.

Select an option

Save grok/d4c2044e95cc761d685d to your computer and use it in GitHub Desktop.
/**
* Excludes our theme from the WordPress update API calls.
*
* @param array $request The arguments used in an HTTP request
* @param string $url The request URL.
* @return array $request The arguments used in an HTTP request.
*/
public function excludeFromThemeUpdates($request, $url)
{
if(0 !== strpos($url, 'https://api.wordpress.org/themes/update-check'))
{
return $request; // Not a theme update request. Bail immediately.
}
$themes = unserialize($request['body']['themes']);
unset($themes[get_option('template')]);
unset($themes[get_option('stylesheet')]);
$request['body']['themes'] = serialize($themes);
return $request;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment