Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This question already has an answer here:

I want to give the "italic" button back the "styling" behaviour, rather than the spammy <em>. I want that button to print a <i> tag, rather than <em>.

<em> tags became popular to spam search engines, but now I want it to be what it is: a styling feature to e.g. change the voice of the narration.

I've got a script to create my own styles, so I'll include the <em> tag there, to use it as what it REALLY is: EMPHASIS. I'll then style it accordingly (big, bold).

So now my problem is, I'm sure I can find the setting / string / parameter to hack in JavaScript, but... Do you know a way to hook it from / for WordPress?

share|improve this question

marked as duplicate by Pieter Goosen, toscho Dec 12 at 12:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3  
Have you read wordpress.stackexchange.com/questions/66724/…? –  toscho Oct 24 '12 at 9:13

1 Answer 1

Here's a simple function that will replace <em> with <i> on your post/page:

function replace_em_with_i($content) {
$content = str_replace('<em>', '<i>', $content);
$content = str_replace('</em>', '</i>', $content);
return $content;
}

add_filter('the_content', 'replace_em_with_i');

Warning: I have tested the code to check if it works (and it does work), but you might want to do some serious testing before using it...

Using a similar function you can replace <strong> with <b>, and so on.

I hope this helps...

share|improve this answer
    
I do not think this is what the user wants - they clearly state that they wish to be able to use both tags, but have the editor button insert an <i> tag. –  bungeshea Mar 15 at 3:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.