[wp-trac] [WordPress Trac] #35287: get_site_url does not accept path parameter
WordPress Trac
noreply at wordpress.org
Sat Jan 2 14:00:52 UTC 2016
#35287: get_site_url does not accept path parameter
--------------------------+-----------------------------
Reporter: WebDevDLo | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.4
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
I've tried this several times and am convinced this is a bug. site_url
(which automatically echoes) works, but the sister function get_site_url
(which I am using to create a javascript variable for use in AJAX) does
not work. It is very easy to replicate the issue.
Here are a few lines to show you the problem I've run into. These are
lines that I can get to work:
$.ajax({
url: <?php echo json_encode(get_site_url() . '/ajax-
random-ad/'); ?>,
That is a work around. The proper way to write this is the following,
which does not work:
$.ajax({
url: <?php echo json_encode(get_site_url('ajax-random-
ad/')); ?>,
This is the first time I've submitted a bug so I'm not an expert on
exactly what you would prefer for troubleshooting, but I am hoping this is
enough for you to do a simple test of your own to replicate the problem.
I have searched the forums and I do not see this but reported yet.
Thank you.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35287>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list