您确定编辑器使用<i> 是否为斜体?我几乎可以肯定它使用<em>.
然而,如果你想绝对确定<i> 在您的帖子内容中,让编辑器执行它想要的操作,然后替换<i> 具有<em> 创建/更新帖子之前,挂钩wp_insert_post_data 过滤器,就像:
add_filter(\'wp_insert_post_data\',\'replace_em\', 20, 1);
function replace_em( $post_data ) {
if ( $post_data[\'post_content\'] != \'\' ) {
$post_data[\'post_content\'] = str_ireplace( array(\'<i>\', \'</i>\'), array(\'<em>\', \'</em>\'), $post_data[\'post_content\'] );
}
return $post_data;
}
即使您插入
<i> 手动将其替换为
<em> 保存时。