Make WordPress Core

Changeset 60237


Ignore:
Timestamp:
05/15/2025 09:56:53 AM (6 weeks ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/options.php

    r58963 r60237  
    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 ) ) {
     
    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
Note: See TracChangeset for help on using the changeset viewer.