Replace or Alter the wp_version_check() Function

Question

As you might know, the discussion about wp_version_check() and update.php has been a hot topic for give or take a decade.

My question is this;
Can we, by using the child theme / custom parent theme, “unset” or somehow replace a core file with our own version of the same and in this case — the update.php file located in the wp-includes folder.

The idea is simple = being able to stop the sending of data to WP. Having spoken to a lot of people, not a single one wants their data transmitted to WP on each update.

That said; I understand that there might be a solution available by using the http_request_args filter hook?

Something like this:

add_filter( 'http_request_args', 'anonymize_ua_string' );
function anonymize_ua_string($args){
global $wp_version;
$args['user-agent'] = 'WordPress/' . $wp_version;

// catch the data set by wp_version_check()
if (isset($args['headers']['wp_install'])){
$args['headers']['wp_install'] = 'https://example.com';
$args['headers']['wp_blog'] = 'https://example.com';
}
return $args;
}

But how well with that work and have someone tested it?

0
, , Moa Andersen 1 year 2020-07-20T00:10:21-05:00 0 Answers 58 views 0

Leave an answer

Browse
Browse