[wp-trac] [WordPress Trac] #34722: Open P Tag in shortcode related to h tag

WordPress Trac noreply at wordpress.org
Fri Nov 27 12:49:02 UTC 2015


#34722: Open P Tag in shortcode related to h tag
--------------------------+------------------------------
 Reporter:  BackuPs       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  close         |     Focuses:
--------------------------+------------------------------

Comment (by StephenCronin):

 Replying to [comment:10 BackuPs]:
 > Note : Themeforest does not allow the use of wpautop()  !!!

 Disclaimer: I work for Envato as Quality Specialist (Themes & Plugins)

 ThemeForest does not allow themes to remove or modify filters where the
 wpautop is run, because that can break plugins. For example, you can't
 remove the filter that applies wpautop to the_content. You should be able
 to apply wpautop to the content in your shortcode as @swissspidy suggests,
 as it won't affecting anything else.

 However, I don't believe wpautop is going to help you in this case.

 To work out what's really going on here, disable your shortcode code, but
 leave the shortcode in the post. You'll then see this in the source:

 {{{
 <p>[theme_div]<br />
 <h3>This is a test heading</h3>
 <p> This is the test body [/theme_div]</p>
 }}}

 When you look at the content inside the shortcode, it's exactly the same
 as what's output when the shortcode is active (ie has the br and doesn't
 close the p).

 I *think* that when wpautop is applied to the_content it should ignore
 anything within shortcodes, but it seems that's not working in this case.

 I'm *guessing* that when h3 is in the shortcode content, wpautop sees the
 h3 first, sees it's not on a new line and adds the br, but then it no
 longer sees it as a shortcode, so it goes ahead and applies the p tags,
 etc.

 There's a lot of guessing going on here, sorry, but I don't have time to
 dig into core right now. I figure I should leave my guesses here in case
 they can help someone else investigate further.

 Note to others: You need to View Source rather than use Firebug or Chrome
 Developer Tools, as they show you the source after the browser has
 compensated for the malformed HTML. For example, the browser will close
 the p tag that was left open, so you won't see that in Firebug or
 Developer Tools.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34722#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list