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, directed or better, calling externally

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 generate more calls, additional DNS lookups, additional TLS handshake delays, etc. So if you don't use the functions, all they cause is , which cause very poor site speed performance.

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 the box ς των modules που δεν χρειάζεστε και από το αναπτυσσόμενο 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 the JavaScript file, devicepx-jetpack.js, which is used to manage image replacements in που διαθέτουν HiDPI (High DPI) και οθόνες .

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. Do a cached drop of your page and try 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.).