How to add values to media “whitelist_options” in wp-admin/options.php template?

firstly, don’t edit core files of WordPress or your changes will be erased at the next update.


in the file options.php look below this array declaration, you have this line :

$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );

that means that you can custom this array with this code in a plugin or the theme :

add_filter("whitelist_options", function ($whitelist_options) {

    $whitelist_options["general"][] = "siteurl";

    return $whitelist_options;

});