Last active
May 23, 2018 14:36
-
-
Save AliceWonderMiscreations/4a8e177f837ebe26c59a9766d626769f to your computer and use it in GitHub Desktop.
Neuters the community events admin privacy leak in WordPress
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
<?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