• Resolved bwooster47

    (@bwooster47)


    Is there a way to have shortcode replacement occur before wpautop adds paragraph or line breaks?
    I would like shortcode replacement be treated as if user had typed the replacement themselves, which means adding br and p tags after the shortcode replacement when applicable.

    If I have a post like this:

    line 1
    line 2
    [myshortcode ...]
    line 3

    I get this output:

    line 1<br />
    line 2<br />
    <a href="...">...</a>
    line 3

    Note the missing <br /> after the [myshortcode] text.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Thread Starter bwooster47

    (@bwooster47)

    Thanks, that looks like a good choice. That article talks a lot about applying the filter to the replacement text, but it also applies in my case described above to apply the filter after the shortcode replacement text.

    Now that I know all this, another way of solving this is to add two consecutives newlines before the shortcode, i.e., one empty line above the shortcode.
    And/or if needed, a dummy character such as (space) after the shortcode.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcode process suppresses following or’ is closed to new replies.