Opened 5 years ago
Last modified 9 days ago
#49056 new defect (bug)
Can we stop bundling default themes?
Reported by: | crdunst | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | minor | Version: | |
Component: | Upgrade/Install | Keywords: | close |
Focuses: | Cc: |
Description
Maybe this has been raised before - I searched, but couldn't find the same suggestion.
Can WordPress stop bundling themes with upgrades?
I understand a default theme (such as TwentyTwenty) makes sense with a fresh install, but not on existing websites, for a number of reasons:
1) Bundled, but unused themes just mean more code overhead. More guessable directories/files for malicious actors to hack.
2) Extra disk space is needed to store these mostly unused themes. Individually it's not much space, but multiply it up into millions of installs, and cumulatively it's significant.
3) Extra bandwidth when they're downloaded for both WordPress.org CDNs, and also for end-user sites.
I deleted 2020 theme from a client's website when upgrading to 5.3, and I've just had to delete it again, presumably after 5.3.1 or 5.3.2 self-installed. They're never going to use one of the default themes (as good as they are) for their corporate site, so it's just a waste of everyone's time. I'm maintaining dozens of sites, so this gets annoying.
There's an argument for 'what about if they delete their only theme - it needs a theme to default to'. This doesn't stack up though if the end-user can manually delete the default theme, and find themselves in the same position. UI can overcome this to a degree when no themes are available with a 'search the repo for a theme, how about twentytwenty (maybe the interface does? I've never tried deleting all themes on an install).
Anyway, just my feedback from a regular user/maintainer.
Change History (12)
#2
follow-ups:
↓ 8
↓ 12
@
5 years ago
Thanks for your response, and for the heads-up on the constant.
It begs two questions for me though:
1) The constant exists, so if it's set, what happens if all themes are then deleted? WP must handle it in some way?
2) If WP doesn't handle 'no themes' gracefully, shouldn't we change that behaviour? A simple message on the front-end, and a notice on the back-end: "you have no theme installed, please install one" or similar?
Someone with time and the inclination could calculate the number of bundled downloads, per incremental updates, and the disk space/bandwidth consumed per year. Cumulatively, perhaps there's an energy wastage issue in this day and age of climate change? Maybe it's trivial, maybe it's not. Just feels like it's an 'always been the case, WP needs it' without challenging the pros/cons.
#3
@
5 years ago
- Focuses coding-standards removed
I wonder:
- What is the logic with this constant to defined and set to false, not true (it contains SKIP)?
- Could a new default theme replace the previous default theme if present and inactive (not for multisite)?
- Should this be a core user option with a UI, perhaps when/if there will be a core UI user option to automatically update major versions?
After a major core update I always delete the previous default theme, on all (single) sites not using this (being the active theme).
Site Health recommends removing unused themes, except (the last or any?) default theme (and parent theme of active child theme). So updating core creates issues in Site Health (new default themes and the bundeled plugins). This is not ideal.
This ticket was mentioned in Slack in #forums by pbiron. View the logs.
5 years ago
#6
@
5 years ago
I'm thrilled to learn about the CORE_UPGRADE_SKIP_NEW_BUNDLED constant. We've been busy deleting and re-deleting twenty-twenty from every site we maintain (about 60). We delete because they will never be needed and will require time and attention when patches are released.
By the way, I agree with @crdunst. You are wasting a tremendous amount of bandwidth and disk storage by auto-installing each year's new theme by default. I see websites just about every day with twenty-twelve, thirteen, fourteen, etc. installed. And none have ever been used. What a waste!
I disagree with the argument about the need for fallback in case the active theme can't be loaded. That's a tremendously weak argument. First of all, that almost never happens with an active website -- and second, I would want the website to crash and notify like it does on a fatal error as I'm sure that my content would look terrible using twenty-twenty. I'd want to be notified so I could address the issue.
#7
@
5 years ago
I assumed that CORE_UPGRADE_SKIP_NEW_BUNDLED needs to be set to TRUE for WordPress to skip installing the default theme as part of core update.
But the source code comments say "To disable new themes from being installed on upgrade, explicitly define CORE_UPGRADE_SKIP_NEW_BUNDLED as false." That's counter-intuitive.
So I explored the code. It appears to me the comment is wrong.
Please clarify, what value should be assigned to CORE_UPGRADE_SKIP_NEW_BUNDLED to tell WordPress not to installs themes when the core is updated?
#8
in reply to:
↑ 2
@
5 years ago
Replying to crdunst:
2) If WP doesn't handle 'no themes' gracefully, shouldn't we change that behaviour? A simple message on the front-end, and a notice on the back-end: "you have no theme installed, please install one" or similar?
I think that was addressed in [25666] / #21670 and [36335] / #21931.
Replying to tomgreer:
I disagree with the argument about the need for fallback in case the active theme can't be loaded.
Another argument is that not bundling new default themes provides a bad user experience for users seeking to experiment with them, see [39064] / #38551.
Replying to tomgreer:
Please clarify, what value should be assigned to CORE_UPGRADE_SKIP_NEW_BUNDLED to tell WordPress not to installs themes when the core is updated?
Thanks for pointing that out, it does look confusing.
Reading through the related commits and tickets:
The comment 8:ticket:34306 clarifies the intention behind explicitly setting the constant to false
to re-enable installing new default themes at the time. Some implementation details have changed between the patches 34306.2.diff:ticket:34306 and 34306.3.diff:ticket:34306.
It looks like current comment refers to a part of [35738] that was later reverted in [39064]. The comment should be updated to reflect the initial intention of the constant as introduced in [17576] / 23:ticket:14484.
To summarize, in order to tell WordPress not to install new themes on update, CORE_UPGRADE_SKIP_NEW_BUNDLED
should be set to true
, as the name suggests.
#10
@
5 years ago
I will add a note for the default theme.
https://github.com/WordPress/WordPress/blob/5.3-branch/wp-includes/default-constants.php#L407
it is also possible to force the use of a predefined theme in the wp-config.php file, before each modification make a backup of the database and files.
I changed it to a multisite directly from the core file.
#12
in reply to:
↑ 2
@
9 days ago
Replying to crdunst:
Someone with time and the inclination could calculate the number of bundled downloads, per incremental updates, and the disk space/bandwidth consumed per year. Cumulatively, perhaps there's an energy wastage issue in this day and age of climate change? Maybe it's trivial, maybe it's not. Just feels like it's an 'always been the case, WP needs it' without challenging the pros/cons.
I thought I'd have a crack at this calculation because I think it's the most compelling reason not to automatically install themes with every major update. The short answer is 1,937 tonnes of CO2 per new default theme released. Assumptions and sources:
- According to Google AI there are 861 million WordPress websites
- I'm assuming 75% updated to the latest version of WordPress and did not have the aforementioned flag set.
- A quick Google brings up a carbon footprint calculator which suggests downloading 3 megabytes releases about 0.003kg of CO2
- I'm not taking into account the impact of the extra storage consumed
Even if you water these numbers down considerably there's an awful lot of CO2 being released here which could seemingly be avoided by providing a simple instruction/alert and a button.
More generally I would have thought when WordPress was starting out the default theme was used a lot of the time. These days I imagine that balance has shifted. But perhaps someone has these numbers...
Quoting @otto42
You can use a constant
CORE_UPGRADE_SKIP_NEW_BUNDLED
: https://core.trac.wordpress.org/browser/tags/5.3/src/wp-admin/includes/update-core.php#L810