Take the 2-minute tour ×

I'm starting to lose my patience with Wordpress. I've downloaded a raw html plugin that should stop wordpress from converting some characters to their entities, I won't use the visual editor but still, every once and a while, it messes up my code. It converts < and > to &lt; and &gt; from some parts of the code and leaves me wondering where the problem is. I'm using 3.4.2, and I'm wondering if there's a way to COMPLETELY stop wordpress from editing my stuff. I mean no automatic paragraphs, no character converting, etc.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

First off, make sure you use the HTML editor in the post screen instead of the visual.

Second, take a look in wp-includes/default-filters.php. It's where you can see how WordPress uses its own hooks API. The stuff that deals with things in the content of posts will be hooked into the_content. Here's the relevant bit.

add_filter( 'the_content', 'wptexturize'        );
add_filter( 'the_content', 'convert_smilies'    );
add_filter( 'the_content', 'convert_chars'      );
add_filter( 'the_content', 'wpautop'            );
add_filter( 'the_content', 'shortcode_unautop'  );
add_filter( 'the_content', 'prepend_attachment' );

So if you don't want autop or convert_chars, you could could remove it (this should probably go in a plugin). Something like this:

// Hook into init to make sure the filter is there to remove.
add_action('init', 'wpse66038_remover');
function wpse66038_remover()
   remove_filter('the_content', 'wpautop');
   remove_filter('the_content', 'convert_chars');
share|improve this answer
Where would I put that autope removal snippet? And to remove character conversion, I would just replace wpautop with convert_chars? –  Christian Sep 23 '12 at 18:19
See my edit: it should probably go in a plugin, but you could also put it in the theme's functions.php file. –  chrisguitarguy Sep 23 '12 at 18:21
I've no idea of how to write a plugin, so I'll put it in functions.php. –  Christian Sep 23 '12 at 19:03
Plugins just mean a a PHP file with a special header. And they go in the wp-content/plugins folder. The above as a plugin –  chrisguitarguy Sep 23 '12 at 19:36
Umm... Actually, I added those lines to the bottom of functions.php, and it actually started converting characters. –  Christian Sep 24 '12 at 6:06
show 2 more comments

Simon solved it... genius...

You have to go into wp-includes and edit the post-template.php and comment out the script in wp that automatically converts it.


share|improve this answer
Link only answers are discouraged. If something happens to that link the answer becomes useless. Please try to make your answer here stand alone. And hacking core files answer are very, very discouraged. I would strongly suggest deleting this or it is likely to accumulate a number of down votes. –  s_ha_dum Nov 14 '13 at 1:32
add comment

Your Answer


