Problem with WordPress messing up HTML with P and BR tags.
Maybe you don’t want to disable wpautop but you are sick of WordPress adding <p> and <br /> tags to your included html.
A solution is to open up wp-includes/formatting-functions.php and modify the wpautop function. In this version, you can make wpautop respect any tags you want. Just add them!
Usage
Simply add your tag name inside the variable below, using the same tag-pip-tag format:
//WP Version 2.0.4
function wpautop($pee, $br = 1) {
$allowedTags = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre| select|fieldset|legend|form|blockquote|address|math|p|h[1-6]';
$allowedCloseTags = 'option|select|p|li|div|dl|dd|dt|th|pre|td|ul|ol';
//WP Version 2.2.3
function wpautop($pee, $br = 1) {
$pee = $pee . "\\n"; // just to make things a little easier, pad the end
$pee = preg_replace('|\\s*|’, “\\n\\n”, $pee);
// Space things out a little
$allblocks = ‘(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)’;
ATTENTION
If you mess up WordPress and can’t get anything to work, you should have made a backup! Sorry!
Relevant links
WordPress Forums: How do I remove <p> from the_content ?
WordPress Forums: Hey Wordpress STOP Screwing up my HTML in my posts!

August 20th, 2007 at 11:35 pm
PS. If you are having this problem but are using a version other than 2.0.3, and you’re not PHP-saavy, and want me to re-write your function… please go to your formatting.php and paste me your wpautop function.
August 29th, 2007 at 9:08 am
The allowed functions are now in this file as of WP-2.2.2
wp-includes/kses.php
September 17th, 2007 at 7:51 am
USELESS,,,
September 17th, 2007 at 8:46 am
…totally useless.
(Unless of course you’re posting HTML, in which case useFUL).
January 1st, 2008 at 10:54 pm
hello. i need some online support pls if u can, just 5 minutes. thx.
ps: u have my e-mail adress in the form (if u have yahoo mess would better)
January 17th, 2008 at 2:14 am
[…] 后来我发现原来在wordpress使用tinymce遇到问题的远远不止我一个。比如这里的一些讨论条目挺有用的,其中有的直接关闭tinymce WYSIWYG功能;有的跟我一样对wpautop()这个函数进行了修改(disable_wpautop);有的修改了tinymce的配置,比如关闭cleanup功能: Download the wp-includes/js/tinymce/tiny_mce.js file using an FTP program and use a text editor to change the following (near line 167) from: […]