Remove Render-Blocking JavaScript devicepx-jetpack.js from WordPress

»»»Remove Render-Blocking JavaScript devicepx-jetpack.js from WordPress

After activating Jetpack for WordPress plugin, a line of HTML code is added to every web pages of the WordPress website to call a JavaScript named devicepx-jetpack.js. The line of HTML code looks like the following:

<script type=’text/javascript’ src=’https://s0.wp.com/wp-content/js/devicepx-jetpack.js?ver=YYYYMM’></script>

JS functions in devicepx-jetpack.js is used to manage image replacements on devices that have HiDPI (High DPI) and Retina display. However, devicepx-jetpack.js gets loaded even though you don’t use any of the Jetpack features, i.e. when you deactivate all Jetpack features but left plugin activated.

It’s possible to remove the loading of devicepx-jetpack.js, by adding the following code snippet into the active theme’s functions.php file:

function tj_dequeue_devicepx() {
    wp_dequeue_script( 'devicepx' );
}
add_action( 'wp_enqueue_scripts', 'tj_dequeue_devicepx' );

By | 2017-06-13T23:24:49+00:00 June 13th, 2017|Categories: Web Publishing|Tags: , |0 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years.Connect with LK through Tech Journey on Facebook, Twitter or Google+.

Pin It on Pinterest

Share This

Share This

Share this post with your friends!