2010-06-11 50 views
5

有人能告訴我如何告訴Wordpress的tinymce編輯器不去掉腳本標籤嗎?我看着wp-admin/includes/post.php並添加wordpress extended_valid_elements腳本標記?

'extended_valid_elements'=>'script[charset|defer|language|src|type]', 

$initArray

當我做了CMS後編輯器查看源代碼,我看到它真的出現,就像這樣:

<script type="text/javascript"> 
/* <![CDATA[ */ 
tinyMCEPreInit = { 
    base : "http://dev.esolar.ca/wp-includes/js/tinymce", 
    suffix : "", 
    query : "ver=327-1235", 
    mceInit : { 
     mode:"specific_textareas", 
     editor_selector:"theEditor", 
     width:"100%", 
     theme:"advanced", 
     skin:"wp_theme", 
     theme_advanced_buttons1:"bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,wp_more,|,spellchecker,fullscreen,wp_adv", 
     theme_advanced_buttons2:"formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,charmap,|,outdent,indent,|,undo,redo,wp_help", 
     theme_advanced_buttons3:"", 
     theme_advanced_buttons4:"", 
     language:"en", 
     spellchecker_languages:"+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv", 
     theme_advanced_toolbar_location:"top", 
     theme_advanced_toolbar_align:"left",   
     theme_advanced_statusbar_location:"bottom", 
     theme_advanced_resizing:"1", 
     theme_advanced_resize_horizontal:"", 
     dialog_type:"modal", 
     relative_urls:"", 
     remove_script_host:"", 
     convert_urls:"", 
     apply_source_formatting:"", 
     remove_linebreaks:"1", 
     gecko_spellcheck:"1", 
     entities:"38,amp,60,lt,62,gt", 
     accessibility_focus:"1", 
     tabfocus_elements:"major-publishing-actions", 
     media_strict:"", 
     paste_remove_styles:"1", 
     paste_remove_spans:"1", 
     paste_strip_class_attributes:"all", 
     wpeditimage_disable_captions:"", 
     plugins:"safari,inlinepopups,spellchecker,paste,wordpress,media,fullscreen,wpeditimage,wpgallery,tabfocus" 
    }, 
    load_ext : function(url,lang){ 
     var sl=tinymce.ScriptLoader; 
     sl.markDone(url+'/langs/'+lang+'.js'); 
     sl.markDone(url+'/langs/'+lang+'_dlg.js'); 
    } 
}; 
/* ]]> */ 
</script> 

但由於某些原因,我的編輯還是不救<script>標籤。我究竟做錯了什麼?

回答

0

我有類似的iframe問題。我認爲,而不是<script attributes>,它可能是[script attributes]。您必須查看語法

5

在你的文章被保存在數據庫中之前,這是過濾到KSES過濾。

在您的主題的functions.php中,全球化變量$allowedpostags,然後添加您希望允許的標籤。

global $allowedposttags; 
$allowedposttags['script'] = array(
    'type' => array(), 
    'src' => array() 
); 

請注意數組的結構以及您必須指定允許的屬性。

+1

,但在wysiwyg編輯器中按下發布後,標籤會立即被刪除。我點擊編輯器中的HTML標籤,,按發佈,頁面刷新,

  • 11. 提取腳本標記
  • 12. 腳本標記不關閉
  • 13. ms:XSLT中的腳本標記
  • 14. 腳本標記在Express
  • 15. 腳本標記屬性 - javascript
  • 16. HTML腳本標記位置?
  • 17. Magento刪除腳本標記
  • 18. Google Maps API腳本標記
  • 19. 腳本標記錯誤
  • 20. 範圍JavaScript腳本標記
  • 21. 過濾出腳本標記
  • 22. 運行腳本標記是否阻止其他腳本標記下載?
  • 23. 腳本標記內的另一個腳本標記不起作用?
  • 24. 腳本src標記加載index.jsp本身
  • 25. 使用腳本標記的跨站點腳本,更改腳本標記的src,我們可以使用id作爲腳本標記
  • 26. WordPress循環標記
  • 27. WordPress排隊腳本不添加腳本
  • 28. jQuery選擇標記內部腳本標記
  • 29. 腳本標記之前的Oozie param標記?
  • 30. DOMDocument刪除腳本標記內的結束標記