I would like to set default values of the media variables on my multisite. If I want to do this on one site, it's a simple thing, I add values on mysite.com/wp-admin/options.php to the image_default_align, image_default_link_type and image_default_size, but I cannot add network global values for these.

So I want to edit it manually the core file: /wp-admin/options.php, but I dont know, how to do this, This level of the php is dont in my line.

Here is the code, which is listing the variables, but for these originally dont order to values:

$whitelist_options = array(
    'general' => array(
    'discussion' => array(
    'media' => array(
    'reading' => array(
    'writing' => array(

The major part this:

    'media' => array(

Here is an example, where (I think) the code ordering values to the variable: $whitelist_options['general'][] = 'siteurl';

I did not manage to do that...


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;

  • Thank you, your guidelines I found it, what I searched: add_action( 'after_setup_theme', 'wnd_default_image_settings' ); function wnd_default_image_settings() { update_option( 'image_default_align', 'center' ); update_option( 'image_default_link_type', 'file' ); update_option( 'image_default_size', 'full-size' ); } Other options: image_default_align: left, right, center, none image_default_link_type: file, page, none image_default_size: thumbnail, medium, large, full-size – Galgóczi Levente Jan 25 '18 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.