How to stop wp-editor() overwriting my HTML?

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?

Topic wp-editor Wordpress

Category Web


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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.