[wp-trac] [WordPress Trac] #44564: wp_make_link_relative(home_url()) returns empty

WordPress Trac noreply at wordpress.org
Wed Jul 18 10:13:05 UTC 2018


#44564: wp_make_link_relative(home_url()) returns empty
---------------------------+------------------------------
 Reporter:  Fleuv          |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Permalinks     |     Version:  4.9.7
 Severity:  normal         |  Resolution:
 Keywords:  needs-testing  |     Focuses:
---------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:  needs-testing close => needs-testing


Comment:

 `wp_make_link_relative()` does keep the slash at the beginning if it's
 originally there in the passed URL. If not, there is nothing to keep :)
 See also #26819.

 I can see how it's confusing though. Maybe it should add the slash if it's
 missing after removing the protocol and domain, but be smart enough not to
 touch the path if it's already relative.

 Or, since it's supposed to return a root-relative path rather than a
 "true" relative path, maybe always adding the slash would be expected.

 That said, it's not used in core since 2.5, we should search the plugin
 repo to see how it's used.

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


More information about the wp-trac mailing list