Instantly share code, notes, and snippets.

Embed
What would you like to do?
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