Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#11359 new enhancement

Don't nofollow links in admin comments

Reported by: caesarsgrunt Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.9
Component: Comments Keywords: needs-patch gsoc
Focuses: Cc:


Links in admin comments shouldn't have rel=nofollow.

Admin comments are not user-generated content, and the site owner (admin) is vouching for the links just like when they link from the post itself.

Therefore, this usage of nofollow is incorrect.

Also, if I go and edit a comment and remove nofollow from a link, WP adds it back. It shouldn't do that either.

Note that in the unlikely event of wanting a link in a comment to be nofollowed, this could still be done manually.

Change History (10)

comment:1 caesarsgrunt4 years ago

See also #11360(Don't nofollow links within the site).

comment:2 caesarsgrunt4 years ago

  • Version changed from 2.9 to 3.0

comment:3 caesarsgrunt4 years ago

  • Milestone set to 3.0
  • Version changed from 3.0 to 2.9

comment:4 hakre4 years ago


add_filter( 'pre_comment_content',  'wp_rel_nofollow',              15    );

from: file wp-includes/default-filters.php line 158.

wp_rel_nofollow() is in wp-includes/formatting.php line 1373.

A fix could be to remove the original filter, add and own as proxy and then check for the comments author. The problem is, that this filter knows nothing about the actual comment. Only the comment text and that's it. Those information can be passed as additional parameter when applying the filter. see wp_filter_comment().

comment:5 hakre4 years ago

I remember that we had a related problem years ago while comment stati where checked / filtered. I think we should pass the actual comment object to those filters as well which will plugin authors enable to differ (and even core functions enable to differ here).

comment:6 follow-up: nacin4 years ago

  • Milestone changed from 3.0 to Future Release
  • Type changed from defect (bug) to enhancement

comment:7 wojtek.szkutnik4 years ago

  • Keywords gsoc added

comment:8 mrmist4 years ago

Related #10550

comment:9 in reply to: ↑ 6 Everfluxx3 years ago

  • Cc Everfluxx added
  • Version changed from 2.9 to 3.1

Replying to nacin:

Still outstanding in 3.1: current version also adds a "rel=external nofollow" attribute to all author URI links, regardless whether the author URI is actually external.

The rel="external" attribute indicates that the referenced document is not part of the same web site as the current document. (Source)

I wrote an open letter to Matt Mullenweg about the default nofollow on admin links issue, and Matt replied to me via email saying that (I'm quoting him verbatim):

People are free to modify WP's default behaviour through plugins, of which there are many in our official directory. I think the current behaviour is the best as default based on our own experience and advice from Google when nofollow was introduced.

Matt did note provide further details as to why he thinks that the current behavior is "the best as default", and did not answer my questions:

How can nofollowing editorial links help combat link spam? How can that benefit users, or search engines?

So, if he didn't change his mind, I didn't change mine, either.

Therefore, I propose to implement the following behavior as default in WordPress:

Automatically add the "rel=nofollow" attribute to all links in comments, except those posted or edited by users with edit_comment capability.

Since I'm not familiar with the discussion, submission and review process for core updates, any pointers or advice would be greatly appreciated. I'm willing to post this to the wp-hackers mailing list and get feedback from other developers and users if deemed necessary. Last but not least, I am willing to contribute a patch for this enhancement.

Version 10, edited 3 years ago by Everfluxx (previous) (next) (diff)

comment:10 solarissmoke3 years ago

  • Version changed from 3.1 to 2.9

Please don't change the Version - it represents the time the bug was first reported, not whether it still exists in the current version.

Note: See TracTickets for help on using tickets.