允许的元素和属性列表存储在全局变量中$allowedposttags
设置为wp-includes/kses.php
.
要覆盖它,请创建一个简单mu plugin 包括以下内容:
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Enable placeholder attribute for input elements in post tags.
* Version: 2012.07.18
*/
add_action( \'init\', \'wpse_54829_register_placeholder\' );
function wpse_54829_register_placeholder()
{
global $allowedposttags;
$default = empty ( $allowedposttags[\'input\'] ) ? array () : $allowedposttags[\'input\'];
$custom = array (
\'placeholder\' => TRUE,
\'name\' => TRUE,
\'value\' => TRUE,
\'size\' => TRUE,
\'maxlength\' => TRUE,
\'type\' => TRUE,
\'required\' => TRUE
);
$allowedposttags[\'input\'] = array_merge( $default, $custom );
}
此帖子包含内容
<input placeholder="pass" required />
使用作者帐户创建: