Skip to content

Instantly share code, notes, and snippets.

@AliceWonderMiscreations
Last active May 23, 2018 14:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AliceWonderMiscreations/4a8e177f837ebe26c59a9766d626769f to your computer and use it in GitHub Desktop.
Save AliceWonderMiscreations/4a8e177f837ebe26c59a9766d626769f to your computer and use it in GitHub Desktop.
Neuters the community events admin privacy leak in WordPress
<?php
/**
* Plugin Name: Neuter Community Events
* Plugin URI: https://gist.github.com/AliceWonderMiscreations/4a8e177f837ebe26c59a9766d626769f
* Description: Strips information from the WordPress community events request
* Version: 0.2
* Author: Alice Wonder Miscreations
* Author URI: https://notrackers.com
* License: MIT
*/
if (! defined('WPINC')) {
exit;
}
/**
* Filters out content sent to events API server.
*
* @param array $args Array of arguments set to the API server.
* @param string $url The url the args are sent to.
*
* @return array Either empty array or the input array, depending upon
* the $url parameter.
*/
function neuter_community_events_leak(array $args, string $url)
{
/* specific to the community events plugin */
if (substr_count($url, 'api.wordpress.org/events') !== 0) {
// This neuters everything sent to the events API server, including the
// blog domain and the location information.
return array();
}
return $args;
}//end neuter_community_events_leak();
/* apply function to the http_request_args filter */
add_filter('http_request_args', 'neuter_community_events_leak', 10, 2);
// end of script
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment