2013-01-21 38 views
2

在自定義插件,我調用一個所見即所得的編輯器是這樣的:WordPress的所見即所得的圖像鏈接打破

<?php the_editor(get_option("reminder_text"), 'reminder_text'); ?> 

一切工作正常,直到我嘗試插入圖片(上傳或外部時鐘源,沒有區別)。

示例:我輸入圖像路徑並正確顯示圖像。當我保存表單並返回時,圖像顯示爲中斷,並且路徑被轉義引號e包圍。 g .:

\"http://www.my-image-link-here.jpg\" 

有人知道如何解決這個問題嗎?

回答

0

這是因爲數據在插入數據庫時​​已經過了清理,所以您需要清理返回的結果get_option

查看關於Data Validation的文檔。

用途:

the_editor(esc_attr(get_option("reminder_text")), 'reminder_text'); 

Related answer在WordPress的StackExchange。