If you use the _fields
argument, then it needs to include id
. Otherwise, getEntityRecords()
will always return a null
, even if the REST API request succeeded.
So to fix the issue in question, you just need to add id
to your args, i.e. _fields: 'id,name,slug'
.
You should also know that per_page
is limited to 100
, so even if you set it to a greater number or even -1
(which means all), the value is always set to max 100.
Related Posts:
- How to use wp.hooks.addAction() in React JS/Gutenberg?
- Extend core block in Gutenberg
- Gutenberg custom block plugin with custom image sizes
- Get loading state of wp data selector
- Hooking a callback into the code within a Gutenberg block
- What do the args for Gutenberg subpackage “hooks” function “doAction” mean?
- Use useSelect/useDispatch instead of withSelect/withDispatch
- How to use wp.hooks.addAction() in React JS/Gutenberg?
- How to transform a legacy widget into a block
- Get Block Attributes in JSON REST API
- Checks when fetching data from multiple REST API endpoints in Gutenberg
- Search for a keyword across post types in a Gutenberg component
- Using apiFetch for retrieving post data in Gutenberg
- useSelect second parameter
- Issue migrating a checkbox-type meta field to the block editor
- Update block once an API request returns with a value
- Embedded data and the _fields parameter in getEntityRecords
- useSelect() plus resolver result is serving cached data incorrectly
- Trigger Javascript on Gutenberg (Block Editor) Save
- Nonce retrieved from the REST API is invalid and different from nonce generated in wp_localize_script
- Set default image link target in Gutenberg image block
- Gutenberg – remove / add blocks with custom script
- What are all the query parameters for getEntityRecords?
- REST API: Backbone and custom endpoint
- How to only enqueue block javascript on the frontend when its needed [duplicate]
- Show control conditionally in Gutenberg
- How to get the ToggleControl Gutenberg component working for a PHP Block
- Is there a core Sortable component in Gutenberg?
- conditional layout based on if Innerblocks is not empty
- getEntityRecord without knowing the post type
- Gutenberg extend blocks add new class name
- initial open/toggle PluginDocumentSettingPanel panel in document setting block editor gutenberg
- WP REST – video and audio players
- Is there an equivalent of the PHP function sanitize_key in Gutenberg?
- When using the block.getSaveElement hook can you output different markup based on whether or not you are in the edit view or the live page view?
- Get post from custom REST endpoint in Gutenberg
- Headless WordPress: How to authenticate front end requests?
- How to add extra attributes to the script tag added via wp_localize_script()
- Correctly handling WordPress core data retrieval in Gutenberg
- Post to WordPress using REST API from external site
- Is there a client side API for handling transients or options?
- How to handle malformed response from WP REST API?
- How do I fire a snackbar notice in admin?
- Rest API authentication issue when called from fetch request in bundle.js
- Gutenberg Modify core taxonomy panel element via wp.hooks.addFilter
- Get HTTP response code on non-2xx apiFetch request
- What is “open()” in MediaUpload?
- WordPress Rest API only returns content when posttype has editor capability
- Why is this gutenberg custom format button only available from the toolbar as a dropdown?
- Adding a text element in between title and blocks container
- Setting HTML properties in a Gutenberg plugin using WordPress settings
- Gutenberg RichText
- Rest API invalid nonce with Backbone Client
- Provide specific example for block variation
- How to handle Gutenberg wp.data async errors?
- Set current tab on a Gutenberg TabPanel component from outside that component
- Block editor: How to check if block editor has initialized and populated the data store?
- Load script after block is inserted
- Gutenberg block “This block appears to have been modified externally” on save
- How to get value of selected page template in Gutenberg editor?
- How do I access site and block editor state data and use `useSelect()` or `withSelect()` to bind it to my components?
- @wordpress/components Button variants not styled
- Block Editor: How to get title and post content within the WordPress admin UI in Javascript?
- Custom block SelectControl works but equivalent ComboboxControl gives errors – where’s my mistake?
- Gutenberg passing block attributes to component in ES6/ESNext
- Can the index.asset.php file be used with the enqueue_block_editor_assets action?
- How can I add Block Style support to the core HTML block in Gutenberg?
- WP REST API Post Status Using JavaScript
- var is undefined in a Gutenberg block
- Gutenberg add extra attributes to custom format
- How to update a meta field of type array in Gutenberg
- Using wp.data.select get actual tags (not id’s) used in post
- event/callback on block update?
- can a buttongroup have a label?
- How to remove p / br elements from gutenbergs editor
- How to disable inline css styles generated by Gutenberg editor?
- Programatically update posts in database from one block to another using transform
- Gutenberg getMedia() in post query doesn’t return all featured images
- InnerBlocks restricting does not work on nested blocks
- Gutenberg: Block validation Failed Richtext undefined
- Add A Tag To A Post Through JavaScript In Gutenberg UI?
- Gutenberg select categories
- Add custom HTML markup to Gutenberg RichText
- Listening change event of taxonomy term checkboxes in Gutenberg editor
- Adding nonce or hashes to inline scripts
- Authentication with the Rest API when using an External Application
- How to return div with custom attributes(Coding a Gutenberg Block)
- Gutenberg get core data – search
- What is the correct way to import the blocks-editor?
- Open MediaUpload from external component in Gutenberg
- Setting/unsetting terms using the Backbone JavaScript client
- Open Featured Image Modal in WordPress Gutenberg onClick of a button
- Gutenberg extend blocks add new class name
- How to add classes and events to image in javascript using Gutenberg?
- Add custom classes for blocks in editor based on custom attributes
- Looping over wordpress meta to create “ ‘s?
- How to display post content in the block editor
- How to load an additional script for a block in the block editor?
- is_front_page() variable not found
- How can I allow HTML in Gutenberg UI elements help text?