Title: &quot;rel=&#039;https://api.w.org/&#039; json&quot; website url is wrong
Last modified: September 1, 2016

---

# "rel='https://api.w.org/' json" website url is wrong

 *  [trishahdee](https://wordpress.org/support/users/trishahdee/)
 * (@trishahdee)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/relhttpsapiworg-json-website-url-is-wrong/)
 * The current link metatag for my site looks like this:
 * `<link rel='https://api.w.org/' href='http://mysite.com/wp-json/' />`
 * However, I have my site inside a directory named “**site**” so it should read:
 * `<link rel='https://api.w.org/' href='http://mysite.com/site/wp-json/' />`
 * Is there a way I can fix this or must it wait for an update?

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [cedcommerce](https://wordpress.org/support/users/cedcommerce/)
 * (@cedcommerce)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/relhttpsapiworg-json-website-url-is-wrong/#post-7547322)
 * Hello Trishah,
    This link is created by wordpress and the url “[http://mysite.com/wp-json/&#8221](http://mysite.com/wp-json/&#8221);
   is created by your site’s home url. Please see the home url of your site it should
   be “[http://mysite.com/&#8221](http://mysite.com/&#8221); or write the following
   code in your functions.php
 *     ```
       <?php
       echo get_home_url();
       ?>
       ```
   
 * And you’ll see the home url of your site it must be “[http://mysite.com/&#8221](http://mysite.com/&#8221);,
   that’s why the link url is “[http://mysite.com/wp-json/&#8221](http://mysite.com/wp-json/&#8221);.
   
   I would suggest that please don’t change it because this is the rest api response
   url created by wordpress, but if you want to change it then add the following
   code in your functions.php
 *     ```
       <?php
       add_filter( 'rest_url', 'your_function' );
       function your_function( $url ) {
        return 'http://mysite.com/site/wp-json/';
       }
       ?>
       ```
   
 * And when you need to get the old url back then just remove the above code.
 *  Thread Starter [trishahdee](https://wordpress.org/support/users/trishahdee/)
 * (@trishahdee)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/relhttpsapiworg-json-website-url-is-wrong/#post-7547414)
 * I see your point. My point is, because some of us put WordPress in it’s own directory,
   the home_url will be wrong for all of us… not just me.
 * Wouldn’t it be better for the core to use `<?php echo site_url(); ?>` instead
   so the url points to the correct file not matter where WordPress is installed?
 *  [cedcommerce](https://wordpress.org/support/users/cedcommerce/)
 * (@cedcommerce)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/relhttpsapiworg-json-website-url-is-wrong/#post-7547499)
 * If you want to change that url, you can change that either using site url or 
   statically, by the filter “rest_url” as told earlier, or like below.
 *     ```
       <?php
           add_filter( 'rest_url', 'your_function' );
           function your_function( $url ) {
           return 'http://mysite.com/site/wp-json/';
           }
       ?>
       ```
   
 * You can change the return url accordingly.
 *  Thread Starter [trishahdee](https://wordpress.org/support/users/trishahdee/)
 * (@trishahdee)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/relhttpsapiworg-json-website-url-is-wrong/#post-7547519)
 * I think I posted this in the wrong category. How to I switch this to “Requests
   and Feedback”?
 *  [girlieworks](https://wordpress.org/support/users/girlieworks/)
 * (@girlieworks)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/relhttpsapiworg-json-website-url-is-wrong/#post-7547524)
 * Hi, [@trishah](https://wordpress.org/support/users/trishah/).
 * > Wouldn’t it be better for the core to use <?php echo site_url(); ?> instead
   > so the url points to the correct file not matter where WordPress is installed?
 * You might want to have a look at [Trac ticket #37020](https://core.trac.wordpress.org/ticket/37020)(
   as I think it explains why this is the way it is).
 *  Thread Starter [trishahdee](https://wordpress.org/support/users/trishahdee/)
 * (@trishahdee)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/relhttpsapiworg-json-website-url-is-wrong/#post-7547527)
 * From Trac ticket #37020:
 * >  The REST API endpoints use home_url() by design for a few reasons:
   >  1. some endpoint data is publicly discoverable so the public facing url (aka
   > home_url) is a better fit
   >  2. we use rewrites to route endpoint requests and
   > guarantee being able to rewrite the site_url()
 * 1. If the file is not in that location and so is not “discoverable” there, it
   does not make sense to me that home-url is a better fit.
    2. Is beyond my technical
   ability to understand.
 * I would be interested to know what percentage of WordPress installs are in their
   own directories to see how many this decision will effect.
 *  [girlieworks](https://wordpress.org/support/users/girlieworks/)
 * (@girlieworks)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/relhttpsapiworg-json-website-url-is-wrong/#post-7547540)
 * [@trishah](https://wordpress.org/support/users/trishah/): What exactly do you
   see in your browser if you visit [http://mysite.com/wp-json/](http://mysite.com/wp-json/)
   in it? (Replacing `mysite` with your **real** domain name, of course.)
 *  Thread Starter [trishahdee](https://wordpress.org/support/users/trishahdee/)
 * (@trishahdee)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/relhttpsapiworg-json-website-url-is-wrong/#post-7547547)
 * I’ve replaced the site identifying information with filler:
 * `{"name":"Site Name","description":"Tagline","url":"http:\/\/mysite.com\/site","
   home":"http:\/\/mysite.com","namespaces":["oembed\/1.0"],"authentication":[],"
   routes":{"\/":{"namespace":"","methods":["GET"],"endpoints":[{"methods":["GET"],"
   args":{"context":{"required":false,"default":"view"}}}],"_links":{"self":"http:\/\/
   mysite.com\/wp-json\/"}},"\/oembed\/1.0":{"namespace":"oembed\/1.0","methods":["
   GET"],"endpoints":[{"methods":["GET"],"args":{"namespace":{"required":false,"
   default":"oembed\/1.0"},"context":{"required":false,"default":"view"}}}],"_links":{"
   self":"http:\/\/mysite.com\/wp-json\/oembed\/1.0"}},"\/oembed\/1.0\/embed":{"
   namespace":"oembed\/1.0","methods":["GET"],"endpoints":[{"methods":["GET"],"args":{"
   url":{"required":true},"format":{"required":false,"default":"json"},"maxwidth":{"
   required":false,"default":600}}}],"_links":{"self":"http:\/\/mysite.com\/wp-json\/
   oembed\/1.0\/embed"}}},"_links":{"help":[{"href":"http:\/\/v2.wp-api.org\/"}]}}`
 * Is this what it is supposed to be?
 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [9 years, 10 months ago](https://wordpress.org/support/topic/relhttpsapiworg-json-website-url-is-wrong/#post-7547548)
 * That looks pretty much like what it looks like for my site, so all in all I’d
   say it’s working as designed.
 * [https://www.sterndata.com/wp-json](https://www.sterndata.com/wp-json)
 * `{"name":"Stern Data Solutions","description":"Technology, Web Sites and More","
   url":"https:\/\/www.sterndata.com","home":"https:\/\/www.sterndata.com","namespaces":["
   oembed\/1.0"],"authentication":[],"routes":{"\/":{"namespace":"","methods":["
   GET"],"endpoints":[{"methods":["GET"],"args":{"context":{"required":false,"default":"
   view"}}}],"_links":{"self":"https:\/\/www.sterndata.com\/wp-json\/"}},"\/oembed\/
   1.0":{"namespace":"oembed\/1.0","methods":["GET"],"endpoints":[{"methods":["GET"],"
   args":{"namespace":{"required":false,"default":"oembed\/1.0"},"context":{"required":
   false,"default":"view"}}}],"_links":{"self":"https:\/\/www.sterndata.com\/wp-
   json\/oembed\/1.0"}},"\/oembed\/1.0\/embed":{"namespace":"oembed\/1.0","methods":["
   GET"],"endpoints":[{"methods":["GET"],"args":{"url":{"required":true},"format":{"
   required":false,"default":"json"},"maxwidth":{"required":false,"default":600}}}],"
   _links":{"self":"https:\/\/www.sterndata.com\/wp-json\/oembed\/1.0\/embed"}}},"
   _links":{"help":[{"href":"http:\/\/v2.wp-api.org\/"}]}}`

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘"rel='https://api.w.org/' json" website url is wrong’ is closed to new
replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 4 participants
 * Last reply from: [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/relhttpsapiworg-json-website-url-is-wrong/#post-7547548)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
