Support » Plugins » Hacks » remove autop from wp_richedit_pre filter

  • not sure how i can modify/replace the function “wp_richedit_pre” from formatting.php to remove this (line 2539 with 3.6.1)
    $output = wpautop($output);

    I ask TinyMCE Advanced to keep my p/br tags, and it works (they are stored in the DB) but the autop mess them while post_content reloaded in the editor

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • Actually just removing this line from wpautop function (formatting.php) may be enough
    $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);

    Then, no need to remove wpautop
    But of course i don’t want to edit core files



    Forum Moderator

    Stop editing WordPress core files then.

    sorry i didn’t make myself clear.
    Actually my question was how to overwrite functions of core files without modifying core file
    Is it actually possible ?



    Forum Moderator

    You could try adding a filter to richedit_pre. Something like:

    function my_richedit_pre($text) {
    	if ( empty($text) ) return $text;
    	$output = strip_tags($text);
    	[ do more stuff? ]
    add_filter('richedit_pre', 'my_richedit_pre');

    might get you started but bear in mind that I’ve not tried this out myself.

    Moderator bcworkz


    Core functions cannot be modified, with the exception of pluggable functions, mostly defined in pluggable.php. All modifications of the way WP operates must be done via filter and action hooks. Doing anything else leads down a dangerous path.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘remove autop from wp_richedit_pre filter’ is closed to new replies.