Green WordPress

How to Reduce Your CO2 Emissions as a WordPress Plugin Developer

Danny van Kooten develops the WordPress plugin Mailchimp for WordPress - with currently almost two million active installations. Through lean development, the extension saves an estimated 59,000 kg of CO2 per month. We talked to Danny about efficient programming and sustainable WordPress.

The internet, WordPress and WordPress hosting consume a lot of energy. How "green" is the leading content management system? And what contribution can we all make, whether as developers or in the use of WordPress? Nine questions to Danny about his initiative CO2 emissions on the web.

Sustainable WordPress: Be part of it

Raidboxes has been committed to a sustainable WordPress from the very beginning. See, among others, our tips on WordPress & sustainability and on green online shops. You want to take more responsibility yourself? Then read our article Green Hosting for WordPress.

Danny, efficient WordPress projects help climate protection. How does the saving work?

To view a web page, a series of files must be downloaded onto the computer. The browser then processes these files to display them on the screen ("render"). The smaller these files are, the less data is transmitted over the internet. This saves energy at all nodes in the network - i.e. between the computer and the server hosting the website.

Sustainable WordPress development

If a website has a lot of visitors, then it pays off enormously to keep it as lean as possible. Because even a minor optimization adds up this way.

Which optimizations for which languages or formats have the greatest influence?

Providing lower resolution videos and images and running less JavaScript is usually the biggest gain. The energy costs involved in transferring a file on the internet additionally depend on which network is used. For example, a fixed internet connection is much more efficient than a wireless mobile connection.

For this reason, the biggest lever is probably to optimise your website to provide lower resolution images and videos.

Optimise WordPress plugin

Mailchimp for WordPress saves about 59 tonnes of CO2 per month. How do you arrive at this figure?

Mailchimp for WordPress loads a JavaScript file on every web page where the plugin is installed. I reduced the size of this file by 20 KB by replacing a third-party library with some custom lines of code. Because we actually only used a very specific part of the library.

Mailchimp WordPress plugin
The Mailchimp WordPress plugin

Since the plugin is activated on about two million websites, this saves about 40 GB of data transfer if each website has exactly one visitor. If you now multiply this by an estimated average of 10,000 monthly visitors per website, you arrive at a saving of about 400,000 GB per month.

Assuming 0.5 kWh per GB of data transmission and 295 grams of CO2 per kWh of energy, this means that the reduction of 20 kB saves a total of approx. 0.5 * 0.295 * 400,000 = 59,000 kg of CO2 per month.

I make a lot of assumptions here about the number of monthly visitors per website, how well devices cache files and what networks are used. However, my main intention was not to give an exact figure. But to show how efficient it can be to think about CO2 savings in our work as well. And not only in other areas of life.

Third-party libraries

How do you manage to build potential savings into your development process?

With my WordPress plugins, I am very careful about retrieving third-party libraries. Namely, whenever I'm working on a file that needs to be loaded into the publicly accessible area of a website where the plugin is enabled. With the advent of NPM and CDN, it has become very easy to build in a dependency.

That's great if you're working on server-side software. But it's less useful when you're working on JavaScript that's supposed to run in the browser. Here's what I think helps:

  • A rough idea of how lower-level languages work
  • To know: What algorithms come into play when using a function of the language you are programming in?

Both are useful when deciding which tools are right for the job. Learning C is ideal for this. Because C is a language in which you have to take care of many details that other languages take away from you or have abstracted.

What tools are there to make the code leaner and more efficient?

For JavaScript and GitHub there is compressed-size-action. With this, you can track the reduction of the file size. Every time you make a change to your code base, you can see immediately whether important files have become larger - and whether this change is worthwhile. For complete websites, I recommend Chrome Lighthouse.

To check the sustainability of a WordPress plugin or theme as a user, you can do the following: The easiest way is to run Chrome Lighthouse before activating a theme or plugin extension. Then run it again once the extension is activated and configured. This way, everyone can decide for themselves whether the function is worth the drop in performance.

"Green" Newsletter

How can newsletters be designed to be attractive and yet conserve resources?

My recommendation: Send emails in plain text format whenever possible. These are less likely to end up in the spam folder. Moreover, study after study shows that plain text also leads to better conversion rates. And of course, such emails consume fewer resources - so it's a win-win situation!

What are the most important levers in everyday online life to save CO2? Also away from WordPress?

The most important leverage is emissions that you impose on others without them having control over it. You can configure your streaming software to load lower resolution videos. But the effect would be far greater if our streaming software did this for us. A website is no different.

A few words about you and your WordPress plugins?

I have been working with WordPress since before Post Types existed. I published my first plugina little over a decade ago. Since 2013, I've been working with a small remote team and building WordPress plugins full time. These days we mainly focus on building plugins that make websites more efficient. Or that emphasise privacy, like our latest pluginKoko Analytics at WordPress.org.

Green WordPress: Your questions

What questions do you have about sustainable development? Feel free to use the comment function. You want to know more about WordPress and sustainability at posts? Then follow us on Twitter, Facebook or via our newsletter.

Did you like the article?

Your rating helps us improve our future content.

Post a comment

Your email address will not be published. Required fields are marked with *.