admin管理员组文章数量:1395780
I've noticed that the admin editor by default embeds any italic texts with <i>
which I intend to use for icon styling. I much more prefer to wrap them with an <em>
. How would I got about changing this?
I've noticed that the admin editor by default embeds any italic texts with <i>
which I intend to use for icon styling. I much more prefer to wrap them with an <em>
. How would I got about changing this?
1 Answer
Reset to default 3Are you sure editor use <i>
for italics? I'm almost sure it uses <em>
.
However, if you want to be absolutely sure there are no <i>
in your post content, let editor do what it want and then replace <i>
with <em>
before creating/updating posts, hooking wp_insert_post_data
filter, just like:
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;
}
Even if you insert <i>
manually, they are replaced with <em>
on saving.
本文标签: Change default italic from ltigt to ltemgt in admin editor
版权声明:本文标题:Change default italic from <i> to <em> in admin editor 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744673681a2618980.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论