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 I'd re-use it by Automattic as it has a very good link 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 to or , call external domains

See below:

https://s0.wp.com/wp-content/js/devicepx-jetpack.js
https://secure.gravatar.com/js/gprofiles.js
https://wp-content/plugins/jetpack/modules/wpgroho.js (φορτώνεται τοπικά)
https://stats.wp.com/e-201500.js
https://wp-content/plugins/jetpack/modules/likes/queuehandler.js (φορτώνεται τοπικά)
https://secure.gravatar.com/css/hovercard.css?ver=201500
https://secure.gravatar.com/css/services.css?ver=201500
https://pixel.wp.com/g.gif

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 relieve your page from too many requests. But not from JavaScript either , devicepx-jetpack.js, το οποίο χρησιμοποιείται για να διαχειρίζεται αντικαταστάσεις εικόνων σε that feature HiDPI (High DPI) and Retina displays.

To get rid of it, you'll need to tamper with its functions.php file yours. The following code will disable JavaScript from the front end as well as from the back end of your site, i.e. 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.

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.100 registrants.

Written by giorgos

George still wonders what he's doing here ...

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).