Skip to main content
deleted 76 characters in body
Source Link

This method for "How would I get a taxonomy/category list inside a Gutenberg block?" at URL:@SE How would I get a taxonomy/category list inside a Gutenberg block? does NOT work for custom taxonomies, e.g.:

wp.data.select('core').getEntityRecords('taxonomy', 'my-custom-taxonomy', {per_page: -1})

and only returns null, whereas the core category, i.e. "category", returns:

wp.data.select('core').getEntityRecords('taxonomy', 'category', {per_page: -1})

returns an entire array of taxonomy term data such as:

  • count
  • description
  • id
  • link
  • meta []
  • name
  • parent
  • slug
  • taxonomy etc.

The official docs at: https://developer.wordpress.org/block-editor/data/data-core/#getEntityRecords are woefully lacking, and whilst there are references to the "getEntityRecords" in GitHub at e.g.: https://github.com/WordPress/gutenberg/blob/04e142e9cbd06a45c4ea297ec573d389955c13be/packages/core-data/src/entities.js there is little in the way of documentation to help!

So here is the question:

How can you return the list of custom taxonomies using the wp.data.select('core').getEntityRecords method?

OR do you need to create a custom store, or use the wp.data Backbone JS?

This method for "How would I get a taxonomy/category list inside a Gutenberg block?" at URL: How would I get a taxonomy/category list inside a Gutenberg block? does NOT work for custom taxonomies, e.g.:

wp.data.select('core').getEntityRecords('taxonomy', 'my-custom-taxonomy', {per_page: -1})

and only returns null, whereas the core category, i.e. "category", returns:

wp.data.select('core').getEntityRecords('taxonomy', 'category', {per_page: -1})

returns an entire array of taxonomy term data such as:

  • count
  • description
  • id
  • link
  • meta []
  • name
  • parent
  • slug
  • taxonomy etc.

The official docs at: https://developer.wordpress.org/block-editor/data/data-core/#getEntityRecords are woefully lacking, and whilst there are references to the "getEntityRecords" in GitHub at e.g.: https://github.com/WordPress/gutenberg/blob/04e142e9cbd06a45c4ea297ec573d389955c13be/packages/core-data/src/entities.js there is little in the way of documentation to help!

So here is the question:

How can you return the list of custom taxonomies using the wp.data.select('core').getEntityRecords method?

OR do you need to create a custom store, or use the wp.data Backbone JS?

This method for @SE How would I get a taxonomy/category list inside a Gutenberg block? does NOT work for custom taxonomies, e.g.:

wp.data.select('core').getEntityRecords('taxonomy', 'my-custom-taxonomy', {per_page: -1})

and only returns null, whereas the core category, i.e. "category", returns:

wp.data.select('core').getEntityRecords('taxonomy', 'category', {per_page: -1})

returns an entire array of taxonomy term data such as:

  • count
  • description
  • id
  • link
  • meta []
  • name
  • parent
  • slug
  • taxonomy etc.

The official docs at: https://developer.wordpress.org/block-editor/data/data-core/#getEntityRecords are woefully lacking, and whilst there are references to the "getEntityRecords" in GitHub at e.g.: https://github.com/WordPress/gutenberg/blob/04e142e9cbd06a45c4ea297ec573d389955c13be/packages/core-data/src/entities.js there is little in the way of documentation to help!

So here is the question:

How can you return the list of custom taxonomies using the wp.data.select('core').getEntityRecords method?

OR do you need to create a custom store, or use the wp.data Backbone JS?

added 287 characters in body
Source Link

This method for "How would I get a taxonomy/category list inside a Gutenberg block?" at URL: How would I get a taxonomy/category list inside a Gutenberg block? does NOT work for custom taxonomies, e.g.:

wp.data.select('core').getEntityRecords('taxonomy', 'my-custom-taxonomy', {per_page: -1})

and only returns null, whereas the core category, i.e. "category", returns:

wp.data.select('core').getEntityRecords('taxonomy', 'category', {per_page: -1})

returns an entire array of taxonomy term data such as:

  • count
  • description
  • id
  • link
  • meta []
  • name
  • parent
  • slug
  • taxonomy etc.

How can you return the list of custom taxonomies usingThe official docs at: https://developer.wordpress.org/block-editor/data/data-core/#getEntityRecords are woefully lacking, and whilst there are references to the wp.data"getEntityRecords" in GitHub at e.select('core')g.getEntityRecords method?: https://github.com/WordPress/gutenberg/blob/04e142e9cbd06a45c4ea297ec573d389955c13be/packages/core-data/src/entities.js there is little in the way of documentation to help!

So here is the question:

How can you return the list of custom taxonomies using the wp.data.select('core').getEntityRecords method?

OR do you need to create a custom store, or use the wp.data Backbone JS?

This method for "How would I get a taxonomy/category list inside a Gutenberg block?" at URL: How would I get a taxonomy/category list inside a Gutenberg block? does NOT work for custom taxonomies, e.g.:

wp.data.select('core').getEntityRecords('taxonomy', 'my-custom-taxonomy', {per_page: -1})

and only returns null, whereas the core category, i.e. "category", returns:

wp.data.select('core').getEntityRecords('taxonomy', 'category', {per_page: -1})

returns an entire array of taxonomy term data such as:

  • count
  • description
  • id
  • link
  • meta []
  • name
  • parent
  • slug
  • taxonomy etc.

How can you return the list of custom taxonomies using the wp.data.select('core').getEntityRecords method?

OR do you need to create a custom store, or use the wp.data Backbone JS?

This method for "How would I get a taxonomy/category list inside a Gutenberg block?" at URL: How would I get a taxonomy/category list inside a Gutenberg block? does NOT work for custom taxonomies, e.g.:

wp.data.select('core').getEntityRecords('taxonomy', 'my-custom-taxonomy', {per_page: -1})

and only returns null, whereas the core category, i.e. "category", returns:

wp.data.select('core').getEntityRecords('taxonomy', 'category', {per_page: -1})

returns an entire array of taxonomy term data such as:

  • count
  • description
  • id
  • link
  • meta []
  • name
  • parent
  • slug
  • taxonomy etc.

The official docs at: https://developer.wordpress.org/block-editor/data/data-core/#getEntityRecords are woefully lacking, and whilst there are references to the "getEntityRecords" in GitHub at e.g.: https://github.com/WordPress/gutenberg/blob/04e142e9cbd06a45c4ea297ec573d389955c13be/packages/core-data/src/entities.js there is little in the way of documentation to help!

So here is the question:

How can you return the list of custom taxonomies using the wp.data.select('core').getEntityRecords method?

OR do you need to create a custom store, or use the wp.data Backbone JS?

added 255 characters in body
Source Link
Loading
Source Link
Loading