Skip to:

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#3067 closed defect (fixed)

bbp_rel_nofollow() can create multiple rel attributes

Reported by: SergeyBiryukov Owned by: johnjamesjacoby
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.3.1
Component: API - Formatting Keywords:


In [4866], wp_rel_nofollow() was replaced with bbp_rel_nofollow().

It's not quite clear to me from the commit message what was wrong with wp_rel_nofollow(), as bbp_rel_nofollow() is almost identical to what was in WordPress trunk at the time, except for stripslashes()/wp_slash().

The issue is that bbp_rel_nofollow() in its current form does not account for two cases:

  • <a href="foo" rel="bar nofollow"> is turned into <a href="foo" rel="bar nofollow" rel="nofollow">, and multiple rel attributes is invalid markup. This was fixed for WordPress in [WP34277], see #WP9959.
  • Links with the site's own domain should not be nofollowed. This was fixed for WordPress in [WP36125], see #WP11360.

Any chance for bbPress to use wp_rel_nofollow() again? If not, I'll submit a patch that backports [WP34277] and [WP36125] to bbp_rel_nofollow(), with some unit tests.

Change History (6)

#1 @johnjamesjacoby
3 years ago

  • Milestone changed from Awaiting Review to 2.6

The bbPress specific version was used for links inside of code blocks dating back to 2013, and WordPress caught up in 2015.

We can deprecate/delete the bbPress version if they're now equal. It's basically only used internally or via filters.

#2 @johnjamesjacoby
3 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 6313:

Common: Update bbp_rel_nofollow_callback() to match latest approach in WordPress.

bbPress continues to have its own version to support this on output vs. pre-save.

Fixes #3067.

#3 @johnjamesjacoby
3 years ago

In 6328:

Common: Remove nofollow from tests. See #3067.

#4 @johnjamesjacoby
3 years ago

In 6336:

Use bbp_rel_nofollow() in bbp_make_mentions_clickable_callback(). See #3067.

#5 @johnjamesjacoby
3 years ago

In 6337:

Use bbp_rel_nofollow() in deprecated bbp_mention_filter() for the sake of parity & coverage. See #3067.

#6 @johnjamesjacoby
3 years ago

In 6338:

Add bbp_rel_nofollow() to bbp_get_cancel_reply_to_link filter.

Also clean-up bbp_get_cancel_reply_to_link() a bit.

See #3067.

Note: See TracTickets for help on using tickets.