[wp-meta] [Making WordPress.org] #3649: add new filter for attributes on link anchor elements in wporg-developer theme

Making WordPress.org noreply at wordpress.org
Thu Jun 7 14:40:42 UTC 2018


#3649: add new filter for attributes on link anchor elements in wporg-developer
theme
---------------------------------------+---------------------
 Reporter:  pbiron                     |       Owner:  (none)
     Type:  enhancement                |      Status:  new
 Priority:  normal                     |   Milestone:
Component:  Developer Hub              |  Resolution:
 Keywords:  has-patch has-screenshots  |
---------------------------------------+---------------------

Comment (by pbiron):

 Replying to [comment:3 obenland]:
 > How about making `$link` filterable in the callback function. That way
 you could modify the output with a little regex and it would require us to
 introduce a new utility function just for that purpose.

 Did you mean to say "...and it would **not** require us to introduce..."?

 That would work, however, I'm not a big fan of filters that operate on
 HTML strings because functions that hook into such filters need to use
 regexes to "parse" the HTML string which is not reliable.

 And the reason my patch introduces the `generate_link()` utility function
 is actually that I find the existing code pretty "unpoetic" by having 6
 different places where an anchor tag is generated (5 of which use string
 concatenation, 1 of which uses `sprintf()` and only 3 of which `esc_url()`
 on the URL).

-- 
Ticket URL: <https://meta.trac.wordpress.org/ticket/3649#comment:4>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list