[wp-trac] [WordPress Trac] #44564: wp_make_link_relative(home_url()) returns empty
WordPress Trac
noreply at wordpress.org
Wed Jul 11 19:57:29 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 close | Focuses:
---------------------------------+------------------------------
Changes (by SergeyBiryukov):
* keywords: needs-testing needs-patch => needs-testing close
Comment:
Hi @Fleuv, thanks for the ticket!
> The following code will return an empty string.
> {{{#!php
> <?php
> echo wp_make_link_relative(home_url());
> }}}
>
>
> The expected result is: '/'
That's because `home_url()` generally does not have a trailing slash.
This should work as expected:
{{{
echo wp_make_link_relative( home_url( '/' ) );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44564#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list