问题描述
是否可以在自定义程序中使用的输入字段上设置最大长度。
比如在数组中添加一些额外的设置:maxlength = > 50;
通过:
$wp_customize->add_control( 'textblock-text-content',array(
'label' => 'Tekstblok tekst','section' => 'textblock_background_section','type' => 'textarea',));
我找不到任何解决方案,我希望这里的任何人都可以指导我解决问题。
解决方法
根据 Customizer Objects docs,您可以像这样使用 input_attrs
参数:
$wp_customize->add_control('textblock-text-content',array(
'label' => 'Tekstblok tekst','section' => 'textblock_background_section','type' => 'textarea','input_attrs' => array(
'maxlength' => 20
)
));