Skip to content

Commit 2bff4f6

Browse files
kraftbjmatticbot
authored andcommitted
Prevent PHP warning in WP Super Cache by avoiding redefining the DONOTCACHEPAGE constant (#41972)
* Avoid redefining constants if they are already defined, as doing so triggers a PHP warning. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/14086460701 Upstream-Ref: Automattic/jetpack@43d27fd
1 parent 186634a commit 2bff4f6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

plugins/multisite.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,14 @@ function wp_super_cache_override_on_flag() {
5353
}
5454

5555
if ( 1 === (int) get_option( 'wp_super_cache_disabled' ) ) {
56-
$cache_enabled = false;
56+
$cache_enabled = false;
5757
$super_cache_enabled = false;
58-
define( 'DONOTCACHEPAGE', 1 );
59-
define( 'SUBMITDISABLED', 'disabled style="color: #aaa" ' );
58+
if ( ! defined( 'DONOTCACHEPAGE' ) ) {
59+
define( 'DONOTCACHEPAGE', 1 );
60+
}
61+
if ( ! defined( 'SUBMITDISABLED' ) ) {
62+
define( 'SUBMITDISABLED', 'disabled style="color: #aaa" ' );
63+
}
6064
if ( is_admin() ) {
6165
add_action( 'admin_notices', 'wp_super_cache_multisite_notice' );
6266
}

0 commit comments

Comments
 (0)