[wp-trac] Re: [WordPress Trac] #4298: wpautop bugs
WordPress Trac
wp-trac at lists.automattic.com
Mon May 11 14:54:06 GMT 2009
#4298: wpautop bugs
-------------------------------+--------------------------------------------
Reporter: Denis-de-Bernardy | Type: defect (bug)
Status: new | Priority: low
Milestone: Future Release | Component: Formatting
Version: 2.7 | Severity: minor
Keywords: needs-patch |
-------------------------------+--------------------------------------------
Comment(by Denis-de-Bernardy):
code I use in my plugin:
{{{
add_filter('content_save_pre', array('sem_fixes',
'fix_wpautop'), 0);
add_filter('excerpt_save_pre', array('sem_fixes',
'fix_wpautop'), 0);
add_filter('pre_term_description', array('sem_fixes',
'fix_wpautop'), 0);
add_filter('pre_user_description', array('sem_fixes',
'fix_wpautop'), 0);
add_filter('pre_link_description', array('sem_fixes',
'fix_wpautop'), 0);
#
# fix_wpautop()
# http://core.trac.wordpress.org/ticket/4298
#
function fix_wpautop($content) {
$content = str_replace(array("\r\n", "\r"), "\n",
$content);
while ( preg_match("/<[^<>]*\n/", $content) ) {
$content = preg_replace("/(<[^<>]*)\n+/", "$1",
$content);
}
return $content;
} # fix_wpautop()
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/4298#comment:10>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list