4

I'm facing a problem, basically if I use the

tags into the html and then change to visual editor, the tags disappear, and it stays in plain text.

Scenario:

  • In HTML mode, I add some p tags to a post I'm editing.
  • I switch to Visual, then back to HTML, and the tag and all of its content are gone.

I'm not using any extended tinymce plugin.

Any Suggestion?

1 Answer 1

3

Wordpress doesn't save <p> tags. Paragraphs are displayed automatically in the TinyMCE visual editor and then the output gets <p> tags automatically (for better or for worse) from the wpautop function.

I avoid using <p> tags. A double line break will automatically be converted to a paragraph at output.

4
  • so basically, there is not any change to avoid this behavior? Commented Nov 15, 2012 at 17:45
  • Unfortunately not, as far as I know. Sorry that the answer is "there is no answer". You could disable the visual editor, but then you will always be obliged to work in HTML-mode. Why do you need a special <p>? Maybe there is another approach we could find. Commented Nov 15, 2012 at 21:49
  • I just didn't want to give a general line height to the body, and keep it only for paragraphs, however there is not other way. Thanks a ton for you answer. Commented Nov 15, 2012 at 22:21
  • I don't think this is quite right. wpautop adds <br /> when it finds a line break; it doesn't strip out <p> tags (according to the docs, anyway). Disabling wpautop doesn't fix this issue.
    – EML
    Commented Dec 25, 2019 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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