• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

RESOLVED Snippet adding <br/> tags after every non-php line

wulongti

New member
Messages
2
Likes
0
Points
1
#1
I have the plugin "Don't Muck My Markup" set to prevent WP from running `wpautop` site-wide, but for some reason all rendered HTML is getting `<br/>` added at the end of every line. Even inside of `<script>` tags, which naturally busts the javascript :(

The code outside the snippet, ie. in the rest of the post/page, is properly not being "Mucked".

Here's an example of the snippet code:
PHP:
$current_user = wp_get_current_user();
    /**
     * @example Safe usage:
     * $current_user = wp_get_current_user();
     * if ( ! $current_user->exists() ) {
     *     return;
     * }
     */
    $userid = $current_user->ID;
    // set the WPuser cookie
    if((!isset($_COOKIE['WPuser']) && $userid > 0) || (isset($_COOKIE['WPuser']) && $_COOKIE['WPuser'] != $userid) ) {
        setcookie('WPuser', $userid, time() + (86400 * 30), "/"); // 86400 = 1 day
    }

echo "<script>
  // setting the WPuser to a global var if needed
    var WPuser =  $userid;
</script>";
And here's what's getting rendered in the DOM:
HTML:
<script><br />
  // setting the WPuser to a global var if needed<br />
    var WPuser = 1;<br />
</script>
While the above is a small example and easily gotten around by one-lining the JS, I've got another snippet that loads an include file and the same thing is happening to each line from the include.. which also has <script> tags getting messed up like this to say nothing of throwing off my layout with all these extra <br/>s :(

Help me Obiwan Webcraftic, you're my only hope.
 
Last edited:

alexkovalev

Program developer
Staff member
Messages
267
Likes
19
Points
18
#2
Hi,

Do you see this problem in the code editor? Or just on the frontend?

Best regards, Alex
 

S.H

New member
Messages
2
Likes
0
Points
1
#3
Hi,
I have the same problem and this is only on the front end. It happened when I updated the plugin.
 

wulongti

New member
Messages
2
Likes
0
Points
1
#6
yeah it was just on the front end. I re-installed the plugin and now the issue is fixed! Thanks for the quick update :D