[wp-trac] [WordPress Trac] #44825: get_rest_url does not respect query args added to get_home_url
WordPress Trac
noreply at wordpress.org
Tue Aug 21 10:12:25 UTC 2018
#44825: get_rest_url does not respect query args added to get_home_url
--------------------------+-----------------------------
Reporter: distinct | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-
api.php#L321
This line appends the rest `$path` to the result of `get_home_url`, which
can be modified by any plugin to have query arguments.
An easy way to fix it is to just append the $path to the parameter to
get_home_url itself
{{{#!php
<?php
//line 315 and further
if ( $wp_rewrite->using_index_permalinks() ) {
$url = get_home_url( $blog_id, $wp_rewrite->index . '/' .
rest_get_url_prefix() . $path, $scheme );
} else {
$url = get_home_url( $blog_id, rest_get_url_prefix() . $path, $scheme );
}
}}}
Hope this helps.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44825>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list