How to Disable Translation Updates Using Code Snippet

[ad_1]

add_filter( 'async_update_translation', '__return_false' );
add_filter( 'auto_update_translation', '__return_false' );

should actually work. With all the code you mentioned, this is the only one supported by the WordPress core. See also:
https://wordpress.stackexchange.com/questions/300764/disabling-translation-update

If that didn’t work for you, the question is where did you put the code? Ideally, it should be inserted in the functions.php of your child theme or via the code snippet plugin.

Thanks, @threadi.

As it turns out, the issue that triggered our inquiry was the plugin, MailPoet. For some reason, the filters do work with MailPoet. You can try it yourself to confirm.

So, to take care of our issue, we decided to use the following code snippet:

add_filter( 'pre_http_request', function ( $result, $args, $url ) {

if ( wp_parse_url( $url, PHP_URL_HOST ) === 'translate.wordpress.com/api/translations-updates/mailpoet/' ) {
    return new WP_Error( 'http_request_not_executed', __( 'User has blocked requests through HTTP.' ) );
}

return $result;

}, 10, 3 );

add_filter( 'pre_http_request', function ( $bFalse, $args, $sUrl ) {

if ( strpos( $sUrl, '//translate.wordpress.com/api/translations-updates/mailpoet/' ) ) {
    return new WP_Error( 'http_request_not_executed', __( 'User has blocked requests through HTTP.') ); 
}

return $bFalse;

}, 10, 3 );

The code snippet was added to our functions.php file via the plugin, Code Snippets.

Worked like a charm.

Again, thank you for your support.

Salud!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer