2

I'm very surprised that an answer to this isn't easy to find. I've been searching for a solution to this problem for some time now. Google has a few sketchy answers, but they're old. My question is this:

When I'm adding content to a page, I prefer to use the "text" tab (not the "visual" one), and I often paste in a large amount of HTML. Each time I do so, and update (save) the page, when I come back, the code has been changed. br tags are added, things are changed to unwanted paragraph tags, etc.

I found this on codex: In formatting.php Change the line

function wpautop($pee, $br = 1)

to function wpautop($pee, $br = 0)

...but I'm opposed to changing the core files (as we all are!).

I've seen ways to turn off TinyMCE, but those articles are over 8 years old, and aren't relevant any longer.

So is there any way I can put in code into the text editor, and have it stay strictly the way I put it in? I'm open to all solutions - I won't be offended if a plugin recommendation is made.

  • PLEASE please, if you think this question doesn't fit this site, just let me know why. Please don't downvote it without at least some clarity. I did my best to make a clear question and I'd really appreciate constructive criticism (if there is any issue that you find). – Mark Mar 10 '15 at 18:21
  • Have you tried removing the wpautop filter from the_content, like remove_filter( 'the_content', 'wpautop' ); ? – czerspalace Mar 10 '15 at 20:57
  • @czerspalace Thanks for your comment; is that possible to do without editing the core files? – Mark Mar 11 '15 at 13:45
  • Mark, yes, you can add that line to the functions.php file in your theme directory – czerspalace Mar 11 '15 at 17:54
  • Have you managed to get this working in the end? I'm stuck on the same problem 3 years later. – zool Aug 10 '18 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.