[wp-trac] [WordPress Trac] #36468: Error in docs of get_home_url() and home_url()

WordPress Trac noreply at wordpress.org
Fri Jul 22 23:37:26 UTC 2016

#36468: Error in docs of get_home_url() and home_url()
 Reporter:  thomaswm      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.0
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  docs

Comment (by thomaswm):

 I've just realized that [35274] has introduced another error in the
 documentation of `get_home_url()` and `home_url()`: The docs now say about
 the `$scheme` parameter:

 > Accepts 'http', 'https', 'relative', 'rest', or null.

 That's not correct. `get_home_url()` and `home_url()` only accept three
 different non-null values for `$scheme`: 'http', 'https' and 'relative'.
 Setting `$scheme = 'rest'` will have the same effect as setting `$scheme =
 null`. See [https://core.trac.wordpress.org/browser/tags/4.5/src/wp-
 includes/link-template.php#L2964 lines 2977ff.] in `link-template.php`:

 {{{ #!php
     if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
         if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow )
             $scheme = 'https';
             $scheme = parse_url( $url, PHP_URL_SCHEME );

Ticket URL: <https://core.trac.wordpress.org/ticket/36468#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list