Created
August 21, 2012 16:57
-
-
Save thefuxia/3417285 to your computer and use it in GitHub Desktop.
T5 Anonymize UA String
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 # -*- coding: utf-8 -*- | |
/** | |
* Plugin Name: T5 Anonymize UA String | |
* Description: Takes your URL out of the UA string. | |
* Plugin URI: http://toscho.de/?p=2101 | |
* Version: 2012.08.21 | |
* Author: Thomas Scholz | |
* Author URI: http://toscho.de | |
* License: MIT | |
* License URI: http://www.opensource.org/licenses/mit-license.php | |
*/ | |
add_filter( 'http_request_args', 't5_anonymize_ua_string' ); | |
/** | |
* Replace the UA string. | |
* | |
* @param array $args Request arguments | |
* @return array | |
*/ | |
function t5_anonymize_ua_string( $args ) | |
{ | |
global $wp_version; | |
$args['user-agent'] = 'WordPress/' . $wp_version; | |
// catch data set by wp_version_check() | |
if ( isset ( $args['headers']['wp_install'] ) ) | |
{ | |
$args['headers']['wp_install'] = 'http://example.com'; | |
$args['headers']['wp_blog'] = 'http://example.com'; | |
} | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment