1
嗨,夥計,我希望有人可以幫助我。我正在學習WordPress主題開發,而我只是在定製者中添加選項。我不知道如何在文本區域正確處理html。我想確保紋理是消毒和安全的,但也允許它輸出HTML。這是我正在使用的功能和代碼。Wordpress Customiser&Sanitization
$wp_customize->add_setting('fs_theme_footer', array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => '',
'sanitize_callback' => 'esc_textarea',
));
$wp_customize->add_control('fs_theme_footer', array(
'type' => 'textarea',
'section' => 'fs_theme_footer',
'label' => __('Textarea Field', 'fluidstudio'),
'description' => '',
));
在我的主題
<?php echo esc_url(get_theme_mod('fs_theme_footer', '')); ?>
我試圖逃跑等不同的變化,但我似乎無法得到輸出正確地顯示爲html,而不是完整的HTML代碼顯示在前面結束。
任何幫助將不勝感激。
感謝
嗨,感謝您的回覆,所以我嘗試了你所建議的那樣<?php echo wp_filter_nohtml_kses(get_theme_mod('fs_theme_footer','')); ?>但不幸的是它沒有區別,它仍然把HTML放在前端。謝謝 – user42668