[resolved] Remove unwanted BR linebreak after tag (3 posts)

  1. DLpres
    Posted 2 years ago #


    This is a straight follow-up to http://wordpress.org/support/topic/remove-unwanted-br-linebreaks-after-label-tags which has been closed.

    I have the exact same issue, something is adding breaks after </label> tags. The affected code is part of Store Locator Plus plugin, I found the relevant part in the plugin that generates this HTML code and there's definitely no
    in there.

    I tried the remove_bad_br_tags function hook mentioned in the thread; I verified that it works for replacing other kinds of text in the document but it doesn't see the </label> tag. Basically
    $content = str_ireplace("</label>", "foobar", $content);
    doesn't do anything.

    The offending page is http://www.test2004.zylight.com/where-to-buy/. Search for "Radius</label>


  2. bcworkz
    Posted 2 years ago #

    Returned values from 'the_content' filter are almost immediately echoed out to the browser. The only way $content could end up differently than what your filter function returns is if a different filter hooked to 'the_content' is also altering content. You might try adding a high numbered 3rd parameter to your add_filter() call in an attempt to get your filter to be applied last.

    You may gain insight to what other filters are involved by doing a var_dump() on the global $wp_filter array which contains all filter function references.

  3. DLpres
    Posted 2 years ago #

    It's working, thanks!!

    My PHP skills are rudimentary but I was able to execute a var_dump. There are 9 other filters hooking to "the_content". Looks like the culprit is "theme_formatter" from my Striking theme, which has priority=99.

    Once I set a higher priority my filter worked as intended.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.