Skip to content

Update constructor initialization to support WP.com API urls #484

Open
@tomsoderlund

Description

@tomsoderlund

I'm trying to figure out how to use WPAPI with a Wordpress.com-hosted blog.

const wp = new WPAPI({
  endpoint: 'https://MYSITE.wordpress.com/wp-json'
})
const posts = await wp.posts().get()
console.log(`posts:`, posts)

But I'm getting “Not Found” errors (if I set the Wordpress privacy to "Private" I get no error!).

I'm used to interacting with Wordpress REST API at https://public-api.wordpress.com/rest/v1.1/sites/MYSITE.wordpress.com/posts but the /wp-json route doesn't seem to be available.

What to do?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions