$wp_cusomize
(WP_Customize_Manager
のインスタンス)のadd_setting
でtype
をtheme_mod
に設定した場合はwp_optionsテーブルのoption_name
列にtheme_mods_{{theme-domain}}
が、option_value
に値がシリアライズして格納されます(下記例ではtheme_mods_{{theme-domain}}
にsampleおよびsample2の値がシリアライズして格納。
$wp_customize->add_setting(
'sample',
array(
'default' => 'default value',
'type' => 'theme_mod', // theme_modを指定した場合 wp_optionsのoption_nameがtheme_mods_{{theme-domain}}のoption_valueにシリアライズして格納される
'transport' => 'refresh',
'sanitize_callback' => '{{ sanitize_callback }}',
)
);
...
$wp_customize->add_setting(
'sample2',
array(
'default' => 'default value',
'type' => 'theme_mod', // theme_modを指定した場合 wp_optionsのoption_nameがtheme_mods_{{theme-domain}}のoption_valueにシリアライズして格納される
'transport' => 'refresh',
'sanitize_callback' => '{{ sanitize_callback }}',
)
);