{"action":"created","issue":{"url":"https://api.github.com/repos/WP-API/node-wpapi/issues/251","repository_url":"https://api.github.com/repos/WP-API/node-wpapi","labels_url":"https://api.github.com/repos/WP-API/node-wpapi/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/WP-API/node-wpapi/issues/251/comments","events_url":"https://api.github.com/repos/WP-API/node-wpapi/issues/251/events","html_url":"https://github.com/WP-API/node-wpapi/issues/251","id":191040578,"number":251,"title":"wp.taxonomies().taxonomy( 'taxonomy_name' ).term( termIdentifier ) doesn't seem to work","user":{"login":"joaojeronimo","id":622337,"avatar_url":"https://avatars.githubusercontent.com/u/622337?v=3","gravatar_id":"","url":"https://api.github.com/users/joaojeronimo","html_url":"https://github.com/joaojeronimo","followers_url":"https://api.github.com/users/joaojeronimo/followers","following_url":"https://api.github.com/users/joaojeronimo/following{/other_user}","gists_url":"https://api.github.com/users/joaojeronimo/gists{/gist_id}","starred_url":"https://api.github.com/users/joaojeronimo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaojeronimo/subscriptions","organizations_url":"https://api.github.com/users/joaojeronimo/orgs","repos_url":"https://api.github.com/users/joaojeronimo/repos","events_url":"https://api.github.com/users/joaojeronimo/events{/privacy}","received_events_url":"https://api.github.com/users/joaojeronimo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-22T15:37:37Z","updated_at":"2016-12-01T13:58:25Z","closed_at":null,"body":"I got `TypeError: wp.taxonomies(...).taxonomy(...).term is not a function`.\r\n\r\nAm I missing anything ?"},"comment":{"url":"https://api.github.com/repos/WP-API/node-wpapi/issues/comments/264179375","html_url":"https://github.com/WP-API/node-wpapi/issues/251#issuecomment-264179375","issue_url":"https://api.github.com/repos/WP-API/node-wpapi/issues/251","id":264179375,"user":{"login":"kadamwhite","id":442115,"avatar_url":"https://avatars.githubusercontent.com/u/442115?v=3","gravatar_id":"","url":"https://api.github.com/users/kadamwhite","html_url":"https://github.com/kadamwhite","followers_url":"https://api.github.com/users/kadamwhite/followers","following_url":"https://api.github.com/users/kadamwhite/following{/other_user}","gists_url":"https://api.github.com/users/kadamwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/kadamwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadamwhite/subscriptions","organizations_url":"https://api.github.com/users/kadamwhite/orgs","repos_url":"https://api.github.com/users/kadamwhite/repos","events_url":"https://api.github.com/users/kadamwhite/events{/privacy}","received_events_url":"https://api.github.com/users/kadamwhite/received_events","type":"User","site_admin":false},"created_at":"2016-12-01T13:58:25Z","updated_at":"2016-12-01T13:58:25Z","body":"@joaojeronimo Thank you for catching this, that documentation is outdated. Term collections are now top-level routes on the `/wp/v2` namespace, and are no longer nested within their parent taxonomy. The result of this is that the nesting operators documented in the README are pointing to a route that no longer exists -- for the custom taxonomy \"genre\", for example, if registered\r\n\r\n```php\r\n\tregister_taxonomy( 'genre', array( 'album' ), array(\r\n\t\t'hierarchical'      => true,\r\n\t\t'show_ui'           => true,\r\n\t\t'show_admin_column' => true,\r\n\t\t'query_var'         => true,\r\n\t\t'rewrite'           => array( 'slug' => 'genre' ),\r\n\t\t'show_in_rest'      => true,\r\n\t\t'rest_base'         => 'genres',\r\n\t\t'rest_controller_class' => 'WP_REST_Terms_Controller',\r\n\t));\r\n```\r\nthen running `wp.taxonomies().taxonomy('genre')` yields this object:\r\n```js\r\n{ name: 'Genres',\r\n  slug: 'genre',\r\n  description: '',\r\n  types: [ 'album' ],\r\n  hierarchical: true,\r\n  rest_base: 'genres',\r\n  _links: \r\n   { collection: [ { href: 'http://yoursite.com/wp-json/wp/v2/taxonomies' } ],\r\n     'wp:items': [ { href: 'http://yoursite.com/wp-json/wp/v2/genres' } ],\r\n     curies: [ { name: 'wp', href: 'https://api.w.org/{rel}', templated: true } ] } }\r\n```\r\nwhich points to the new location of the Genres collection, `/wp/v2/genres`.\r\n\r\nTo access this via the API, you have two options. First, autodiscovery should detect and bind to that collection automatically:\r\n\r\n```js\r\nWPAPI.discover('http://wpapi.loc')\r\n  .then(wp => {\r\n    // site client instance now has a \"genres\" method to query against that collection\r\n    return wp.genres();\r\n  });\r\n```\r\n\r\nAlternatively, you can make a function to query the genres manually using a [custom route handler](http://wp-api.org/node-wpapi/custom-routes/):\r\n\r\n```js\r\nwp.genres = wp.registerRoute( 'wp/v2', '/genres/(?P<id>)' );\r\n```\r\n\r\nI'm renaming this issue to capture the needed documentation updates."}}
{"actor":{"display_login":"kadamwhite"}}