0

I have the old problem that the WordPress editor overwrites my HTML code. For example, the editor inserts <p> and <br> tags where you don't have them set.

The second problem is the editor doesn't show the real source code. If I write some code in the editor, and update, and look afterwards at the source code in the front-end (e.g. with Firefox), it shows there are tags which I can't see in the back-end editor.

To suppress the problem, I installed the TinyMCE A. Editor, but it doesn't always work. Why must I have an external editor to change it? Can't WordPress have it's own solution for this little bug?

I wish that WordPress would have the option to switch the Editor ON or OFF, so the user can choose. Some kind of solution might be a supplement in functions.php, where you can add shortcodes; I think that is laborious, but could it be the real solution?

2

1 Answer 1

0

If you were always writing in HTML, you could add the following to your functions.php file:

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

I do this for some of my own sites.

As it sounds like you want the option to turn this on or off, you may want to try the wpautop control plugin.

This should let you turn it off on your posts, while leaving it on for other users.

4
  • Hello, thanks your answer.. I always write in HTML, but the EndUser of my themes will have the visual edit. I´ve heard that remove_filter( 'the_content', 'wpautop' ); and the remove_filter( 'the_excerpt', 'wpautop' ); will remove all empty -p- , -/p- elements from all over the document. so I don't want to try it out..I don't want to broke my complete work. Have you some experience with the filters? Run your editor so as you like, or will you become problems after switching between visual and html?
    – footer
    Commented Oct 16, 2014 at 8:35
  • I've found a reference page, which have the solution with JQuery.. But I think, that WordPress provide itself, JQuery can´t be the solution, not all people like Javascript on her site and switch the browserfunction off. stackoverflow.com/questions/22710524/…
    – footer
    Commented Oct 16, 2014 at 8:44
  • My end solution of the problem was now the description in stackoverflow.com/questions/22710524/…, with the supplement of the function.php from user ravi patel:
    – footer
    Commented Oct 16, 2014 at 14:50
  • [raw][/raw] this way is the only way it runs so I want - hope this WP-bug will provided by WordPress in next Version. I´ll send a bug report and the request tho change..
    – footer
    Commented Oct 16, 2014 at 14:57

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.