Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 7 months ago

#9765 closed defect (bug) (fixed)

Erroneous balanceTags call? forceBalanceTags should be used?

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by: denis-de-bernardy's profile Denis-de-Bernardy
Milestone: 2.8 Priority: low
Severity: minor Version: 2.7
Component: Formatting Keywords: has-patch tested commit
Focuses: Cc:


In get_the_content(), the more_link gets added after the call to balanceTags. Shouldn't it get added before it?

Attachments (2)

9765.diff (539 bytes) - added by Denis-de-Bernardy 15 years ago.
9765.2.diff (546 bytes) - added by Denis-de-Bernardy 15 years ago.

Download all attachments as: .zip

Change History (14)

#1 @markjaquith
15 years ago

If it is added before it, you could get closing tags AFTER the more_link, which might be undesired. For instance, if you have a formatting div around your teaser, and you forget to close it. balanceTags would extend that div to enclose the more_link.

#2 @Denis-de-Bernardy
15 years ago

  • Keywords needs-patch added; has-patch removed

possibly. the only thing I do know is that this is one of those areas in the code that tends to break a lot.

this post, for instance, will almost invariably wreck a front page due to the fact that it's not enforcing balanceTags properly:


foo <!--more-->


shouldn't forceBalanceTags be used, rather than a straight balanceTags call?

#3 @Denis-de-Bernardy
15 years ago

  • Summary changed from erroneous balanceTags call? to Erroneous balanceTags call? forceBalanceTags should be used?

#4 @markjaquith
15 years ago

So, force it just in this context (when there is a more_link)?

#5 @Denis-de-Bernardy
15 years ago

imo, yeah. try it on a theme that sets its layout with div tags. you're essentially guaranteed that things will break (i.e sidebars gets knocked down in IE) if you do not opt to use balanceTags in the first place.

#6 @Denis-de-Bernardy
15 years ago

this case is also tricky (and was the reason I suggested the initial patch:


<p>foo <!--more--></p>


the balanceTags call before the more tag, rather than after, prevents the more link from being appended to the end of the paragraph.

#7 @Denis-de-Bernardy
15 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

#8 @Denis-de-Bernardy
15 years ago

  • Keywords tested added; needs-testing removed

the tests *easily* break kubrick, btw. and the second patch makes things work as expected by the user in both cases.

#9 @Denis-de-Bernardy
15 years ago

  • Keywords commit added

#11 @Denis-de-Bernardy
15 years ago

  • Owner set to Denis-de-Bernardy
  • Status changed from new to accepted

#12 @ryan
15 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [11398]) Add more link and then force_balance_tags. Props Denis-de-Bernardy. fixes #9765

Note: See TracTickets for help on using tickets.