Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #44564, comment 4


Ignore:
Timestamp:
07/18/2018 08:56:37 AM (6 years ago)
Author:
Fleuv
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #44564, comment 4

    initial v1  
    11Replying to [comment:3 SergeyBiryukov]:
    2 > Hi @Fleuv, thanks for the ticket!
    3 >
    4 > > The following code will return an empty string.
    5 > > {{{#!php
    6 > > <?php
    7 > > echo wp_make_link_relative(home_url());
    8 > > }}}
    9 > >
    10 > >
    11 > > The expected result is: '/'
    12 >
    132> That's because `home_url()` generally does not have a trailing slash.
    14 >
    15 > This should work as expected:
    16 > {{{
    17 > echo wp_make_link_relative( home_url( '/' ) );
    18 > }}}
    193
    20 Same goes for site_url(). Although it is confusing to note "Keeps the path '/' at the beginning" in the documentation if that isn't always true.
     4Same goes for `site_url()`. Although it is confusing to note "Keeps the path '/' at the beginning" in the documentation if that isn't always true.