WordPress: Hack to Jetpack for better performance

I remember when I started with WordPress, Jetpack was one of the first plugins I used. The add-on has a lot of features in a single package, which was very appealing to an n00b like me. Later I started disabling features, and in the end I left only Site Stats and Protect.

Finally I turned off Jetpack completely because the plugin always burdens WordPress with too many requests on its servers Automattic, which has a direct effect on the speed of the site using the add-on.jetpack

Lately, however, even after Disable Disqus, I thought to re-use the Automattic plugin, as it has a very good login system for WordPress comments.

But what I definitely did not want was to make discounts on the performance of iGuRu.gr. Below we will see how you can disable all external requests that Jetpack sends to WordPress.

When you install Jetpack, you will notice a lot of HTTP requests, addressed or better yet, called external domains

See below:

https://wp-content/plugins/jetpack/modules/wpgroho.js (φορτώνεται τοπικά)
https://wp-content/plugins/jetpack/modules/likes/queuehandler.js (φορτώνεται τοπικά)

All these functions create more requests (calls), additional DNS searches, additional delays for TLS handshake, etc. So if you do not use the functions, they only cause problems, which lead to very poor performance in the speed of the site.

Let's see how you can turn off all requests in the Jetpack add-on, and then how you can turn on the feature you need.

Click on "Settings" in Jetpack.
Scroll to the end and click on "Debug".
Click "Access to the full list of Jetpack units available on your site".

Click on the selection of modules that you do not need and from the drop-down menu select "Disable". Of course you can select them all and then activate the ones you want.

Some of the features of Jetpack do not generate external requests, for example, I have disabled everything except: Comments, Notifications, and Protect.

The above steps will rid your page of too many requests. But not from the JavaScript file, devicepx-jetpack.js, which is used to manage image replacements on HiDPI (High DPI) devices and Retina displays.

To get rid of it, you need to tweak your theme's functions.php file. The following code will disable JavaScript from the front and back end of your site, ie it will disappear.

Open functions.php with your favorite editor (try it Notepad + + for Windows or geany for Linux) and at the end of the file add:

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

That's it. Make a drop in the cached files of your page and try in GTMetrix to see your site. The service, after testing your page, will show you (in Waterfall) all HTTP requests.

The only change from previous tests in GTMetrix, on the page of iGuRu.gr, is that the Total Page Size was raised to 202KB from the previous 180 (without changes in the image).

But devicepx has completely disappeared.

I'm not a friend of Jetpack because I think performance is more important. For others, however, this add-on is considered top notch, especially if they are not interested in the requests it sends.

Registration in iGuRu.gr via Email

Enter your email to subscribe to the email notification service for new posts.

Read them Technology News from all over the world, with the validity of iGuRu.gr

Follow us on Google News iGuRu.gr at Google news