Skip to content

Instantly share code, notes, and snippets.

@thefuxia
Created August 21, 2012 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefuxia/3417285 to your computer and use it in GitHub Desktop.
Save thefuxia/3417285 to your computer and use it in GitHub Desktop.
T5 Anonymize UA String
<?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