Skip to content

Commit 8adb64d

Browse files
Options, Meta APIs: Disable siteurl and home fields on All Settings screen when defined as constants.
This aims to bring consistency with the General Settings screen, where these fields are disabled (read-only) if the `WP_SITEURL` and `WP_HOME` constants are defined in `wp-config.php`. Follow-up to [208], [5093], [5394]. Props dilipbheda, Presskopp, SergeyBiryukov. Fixes #63341. git-svn-id: https://develop.svn.wordpress.org/trunk@60237 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 24dde23 commit 8adb64d

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/wp-admin/options.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,21 +404,32 @@
404404
continue;
405405
}
406406

407+
if ( 'home' === $option->option_name && defined( 'WP_HOME' ) ) {
408+
$disabled = true;
409+
}
410+
411+
if ( 'siteurl' === $option->option_name && defined( 'WP_SITEURL' ) ) {
412+
$disabled = true;
413+
}
414+
415+
$class = 'all-options';
416+
407417
if ( is_serialized( $option->option_value ) ) {
408418
if ( is_serialized_string( $option->option_value ) ) {
409419
// This is a serialized string, so we should display it.
410420
$value = maybe_unserialize( $option->option_value );
411421
$options_to_update[] = $option->option_name;
412-
$class = 'all-options';
413422
} else {
414423
$value = 'SERIALIZED DATA';
415424
$disabled = true;
416-
$class = 'all-options disabled';
417425
}
418426
} else {
419427
$value = $option->option_value;
420428
$options_to_update[] = $option->option_name;
421-
$class = 'all-options';
429+
}
430+
431+
if ( $disabled ) {
432+
$class .= ' disabled';
422433
}
423434

424435
$name = esc_attr( $option->option_name );

0 commit comments

Comments
 (0)