特権管理者じゃなくてもdlとかのclassを消されたり、WordPress Importerで投稿をインポートした時記事内にiframeとかobjectとかあっても消されたりしないようにする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//HTMLの自動整形を解除 | |
function set_allowedposttags($content){ | |
global $allowedposttags; | |
$allowedposttags['dl'] = array( | |
'class' => array(), | |
'id' => array() | |
); | |
$allowedposttags['dt'] = array( | |
'class' => array(), | |
'id' => array() | |
); | |
$allowedposttags['dd'] = array( | |
'class' => array(), | |
'id' => array() | |
); | |
$allowedposttags['iframe'] = array( | |
'class' => array(), | |
'src' => array(), | |
'width' => array(), | |
'height' => array() , | |
'frameborder' => array(), | |
'scrolling' => array(), | |
'marginheight' => array(), | |
'marginwidth' => array() | |
); | |
$allowedposttags['object'] = array( | |
'class' => array(), | |
'data' => array(), | |
'width' => array(), | |
'height' => array(), | |
'type' => array() | |
); | |
$allowedposttags['param'] = array( | |
'class' => array(), | |
'name' => array(), | |
'value' => array() | |
); | |
return $content; | |
} | |
add_filter('content_save_pre', 'set_allowedposttags', 8); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
プラグイン化してみた。
https://github.com/mypacecreator/my_allowedposttags
マルチサイトの場合はAutomattic謹製のプラグインがある。ちょっと古いけど。
http://wordpress.org/plugins/unfiltered-mu/