WordPress.org

Ready to get started?Download WordPress

Forums

<BR> stripping problem - Ultimate solving. (2 posts)

  1. cifronet.com
    Member
    Posted 4 years ago #

    Hello all those with problems when <*br> (with no *) is stripped.

    Here my solution:

    You need to modify two files:
    1. PHP(backend) file, which proceeds stripping on serverside.
    2. Javascript(frontend) file, which proceeds stripping right in your browser.

    So, lets go:

    1. Find file /wordpress_root/wp-admin/js/editor.js.
    This file is a compact version of human-readable file:
    Find file /wordpress_root/wp-admin/js/editor.dev.js.

    You do what:

    • edit file /wordpress_root/wp-admin/js/editor.dev.js.
    • Find line with code:
      pee = pee.replace(/<br \/>\s*<br \/>/gi, '\n\n');

      replace it with

      //pee = pee.replace(/<br \/>\s*<br \/>/gi, '\n\n');

      Btw, this file contains rules for <p> stripping and other. Play with it for your own.

    • b. save it as /wordpress_root/wp-admin/js/editor.js and overwrite it.

    Now move to backend file:

    • a. find file /wordpress_root/wp-includes/formatting.php
    • b. find line:
      $text = str_replace('<br />', '', $text);

      replace it with:

      //$text = str_replace('<br />', '', $text);

    • save it

    Now you modified your backend and frontend.

    Problem solved.

    Tested at 2.9.2 WordPress.

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    And keep good notes of those changes, since you will lose them on every WP upgrade

Topic Closed

This topic has been closed to new replies.

About this Topic