Make WordPress Core

Opened 5 weeks ago

Last modified 3 weeks ago

#66053 new defect (bug)

Remove constants from Site Health (or better mark as deprecated)

Reported by: zodiac1978 Owned by:
Priority: normal Milestone: 7.2
Component: Site Health Version: 5.0
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Follow-up to #63017

There are three constants for enabling PHP-based compression, which are not used anymore:

define( ‘COMPRESS_CSS’, true );
define( ‘COMPRESS_SCRIPTS’, true );
define( ‘ENFORCE_GZIP’, true )

Therefore, we should also remove them from the Site Health screen or maybe start with marking them as deprecated.

It looks like we are not showing ENFORCE_GZIP, but the other two:

​https://github.com/WordPress/WordPress/blob/de3286bd085400ca657d59c8c4e76632bd5591a8/wp-admin/includes/class-wp-debug-data.php#L1519-L1535

We could not show them if the constant is undefined.

If the constant is defined, we could show the value and add a notice that this doesn't do anything anymore.

Change History (4)

#1 @westonruter
5 weeks ago

  • Milestone Awaiting Review → 7.2

Related to eliminating script/style concatenation in #57548.

These constants would be removed.

This ticket was mentioned in ​PR #13493 on ​WordPress/wordpress-develop by ​@haritpanchal.


4 weeks ago
#2

  • Keywords has-patch added; needs-patch removed

The Site Health "Info" tab currently shows COMPRESS_SCRIPTS and COMPRESS_CSS under WordPress Constants. Per westonruter's comment on the ticket, these constants no longer have any practical effect on most hosts and will be removed as part of the ongoing work in #57548 to retire wp-admin script/style concatenation (load-scripts.php/load-styles.php). This removes their now-misleading display from Site Health ahead of that — the constants themselves and their functional use in script_concat_settings() are untouched; this is a Site Health display change only.

ENFORCE_GZIP was also mentioned in the ticket description but is not currently shown in Site Health, so no change was needed for it.

## Testing instructions

  1. Go to Tools → Site Health → Info → WordPress Constants.
  2. Confirm COMPRESS_SCRIPTS and COMPRESS_CSS no longer appear in the list.
  3. Confirm all other constants (CONCATENATE_SCRIPTS, WP_ENVIRONMENT_TYPE, etc.) are still listed correctly.
  4. npm run test:php -- --group site-health passes (44 tests).
  5. vendor/bin/phpcs --standard=phpcs.xml.dist src/wp-admin/includes/class-wp-debug-data.php is clean.

Trac ticket: https://core.trac.wordpress.org/ticket/66053

## Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Identifying the exact code to remove, drafting the diff and changelog note, and running the coding-standards/PHPUnit/manual smoke checks. I reviewed the diff and test output before opening this PR.

#3 @haritpanchal
4 weeks ago

Opened a PR removing COMPRESS_SCRIPTS and COMPRESS_CSS from the WordPress Constants section in Site Health: ​https://github.com/WordPress/wordpress-develop/pull/13493

Per comment:1, this only removes their display in WP_Debug_Data::get_wp_constants() — the constants and their functional use in script_concat_settings() are left alone, since that's covered separately by #57548. ENFORCE_GZIP wasn't shown in Site Health to begin with, so nothing to do there.

Verified with npm run test:php -- --group site-health (44/44 passing), phpcs against phpcs.xml.dist (clean), and a manual check confirming the two keys are gone from the returned fields while the rest are untouched.

​@nicoblandel commented on ​PR #13493:


3 weeks ago
#4

I tested Site Health page, constants seem ok.
https://github.com/user-attachments/assets/996856f8-e600-4fde-a92d-5417e63c4d27

Note: See TracTickets for help on using tickets.