Make WordPress Core

Opened 7 weeks ago

Last modified 6 weeks ago

#63524 new enhancement

Add DISABLE_WP_CRON to site health constants

Reported by: leedxw's profile leedxw Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.8
Component: Site Health Keywords: has-patch has-test-info has-screenshots 2nd-opinion
Focuses: Cc:

Description

I recently had to confirm for a site owner that DISABLE_WP_CRON was set, and was surprised that it's not listed as a constant in the Info section of Site Health.

Referencing piecemeal approach from #51326

Attachments (2)

health_disable_cron.patch (890 bytes) - added by leedxw 7 weeks ago.
Add DISABLE_WP_CRON as a constant in Info
63524.diff (1.1 KB) - added by hmbashar 6 weeks ago.
I've updated it using the proper diff format for compatibility with Grunt Patch.

Download all attachments as: .zip

Change History (12)

@leedxw
7 weeks ago

Add DISABLE_WP_CRON as a constant in Info

#1 @rollybueno
7 weeks ago

Reproduction Report

This report validates that the issue can be reproduced.

Environment

  • OS: Linux 6.8.0-60-generic x86_64
  • Web Server: nginx/1.26.1
  • PHP: 8.2.27 (Supports 64bit values)
  • WordPress: 6.8.1
  • Browser: Chrome 136 on Linux
  • Theme: Twenty Twenty-Five (twentytwentyfive) 1.2
  • Active Plugins:
    • Query Monitor 3.17.2
    • User Switching 1.9.2

Actual Results

  • ✅ Error condition occurs (reproduced).

Additional Notes

  • You have to set define( 'DISABLE_WP_CRON', true ); on the wp-config.php
  • Then go to Tools -> Site Health -> Info -> WordPress Constants
  • The DISABLE_WP_CRON constant is not listed

Supplemental Artifacts

https://i.imgur.com/Lyi7tTM.png

Last edited 7 weeks ago by rollybueno (previous) (diff)

#2 @rollybueno
7 weeks ago

  • Keywords has-test-info added

#3 @rollybueno
7 weeks ago

Test Report

This report validates that the indicated patch addresses the issue.

Patch tested: https://core.trac.wordpress.org/attachment/ticket/63524/health_disable_cron.patch

Environment

  • OS: Linux 6.8.0-60-generic x86_64
  • Web Server: nginx/1.26.1
  • PHP: 8.2.27 (Supports 64bit values)
  • WordPress: 6.8.1
  • Browser: Chrome 136 on Linux
  • Theme: Twenty Twenty-Five (twentytwentyfive) 1.2
  • Active Plugins:
    • Query Monitor 3.17.2
    • User Switching 1.9.2

Actual Results

  • ✅ Issue resolved with patch.

Additional Notes

  • After I set define( 'DISABLE_WP_CRON', true ); on the wp-config.php, I check the value on Tools -> Site Health -> Info -> WordPress Constants and I confirmed it's visible and has correct values

Supplemental Artifacts

define( 'DISABLE_WP_CRON', false );

https://i.imgur.com/HfSk5AE.png

define( 'DISABLE_WP_CRON', true );

https://i.imgur.com/QTnqmax.png

#4 @hbhalodia
7 weeks ago

Hi @rollybueno @leedxw, Not sure we need to add this constant to the class-wp-debug-data.php, because there are many constants which can/are added, for example, WP_POST_REVISIONS, WP_DEFAULT_THEME and many more.

So we need to identify all the list of constant that needs to be added or we should not add more to the list.

We do have all the constant listed here - https://github.com/WordPress/WordPress/blob/master/wp-includes/default-constants.php, which can use a SOT to add the constants to the site info table.

Thank You,

Last edited 7 weeks ago by hbhalodia (previous) (diff)

#5 @rollybueno
7 weeks ago

  • Keywords has-screenshots 2nd-opinion added

#6 @rollybueno
7 weeks ago

Hi @hbhalodia, actually that makes sense. I'll wait for others to chime. Most likely we do not need to add everything but I'll leave that to the rest to decide.

#7 @huzaifaalmesbah
6 weeks ago

Test Report

Description

Patch tested: https://core.trac.wordpress.org/attachment/ticket/63524/health_disable_cron.patch

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.4.7
  • Server: nginx/1.27.5
  • Database: mysqli (Server: 9.3.0 / Client: mysqlnd 8.4.7)
  • Browser: Chrome 137.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.2
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. DISABLE_WP_CRON appears correctly in Site Health debug info.
  2. ✅ Verified both true and false values.

Additional Notes

  • ✅ Patch is functionally correct.
  • ⚠️ Should be updated to use proper Unified Diff format for compatibility with grunt patch.

Screenshots

False True
https://i.ibb.co/Y4Ghm4jw/Huzaifa-20250605161709.png https://i.ibb.co/Z6JBvYHz/Huzaifa-20250605162646.png
Last edited 6 weeks ago by huzaifaalmesbah (previous) (diff)

This ticket was mentioned in Slack in #core-test by huzaifaalmesbah. View the logs.


6 weeks ago

@hmbashar
6 weeks ago

I've updated it using the proper diff format for compatibility with Grunt Patch.

#9 @peterwilsoncc
6 weeks ago

I briefly discussed this with @desrosj at the WCEU contributor day.

Incorrectly setting DISABLE_WP_CRON === true without configuring a real cron system will trigger site health reports that wp-cron is not firing correctly. For hosting providers attempting to provide support to users, including the configuration information could prove helpful.

I've not worked in hosting support so welcome others' views who have had personal experience.


Patch feedback:

I agree that DISABLE_WP_CRON: Disabled would not be helpful due to the double negative. However, I'd prefer it to display as true or similar rather than the 1 displayed when using the current patch.

For the case in which the constant is defined, I'd suggest the text be WP-Cron disabled vs WP-Cron enabled.

This ticket was mentioned in PR #8928 on WordPress/wordpress-develop by @rollybueno.


6 weeks ago
#10

Adds proper handling of DISABLE_WP_CRON constant in WP_Debug_Data class, including translation support and debug value tracking. Feedback of https://core.trac.wordpress.org/ticket/63524#comment:9

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

Note: See TracTickets for help on using tickets.