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
- Set default image link target in Gutenberg image block
- What are all the query parameters for getEntityRecords?
- How to only enqueue block javascript on the frontend when its needed [duplicate]
- Is there a core Sortable component in Gutenberg?
- Is there an equivalent of the PHP function sanitize_key in Gutenberg?
- Get post from custom REST endpoint in Gutenberg
- How to add extra attributes to the script tag added via wp_localize_script()
- Correctly handling WordPress core data retrieval in Gutenberg
- Is there a client side API for handling transients or options?
- How do I fire a snackbar notice in admin?
- Gutenberg Modify core taxonomy panel element via wp.hooks.addFilter
- Get HTTP response code on non-2xx apiFetch request
- What is “open()” in MediaUpload?
- 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
- Provide specific example for block variation
- Block editor: How to check if block editor has initialized and populated the data store?
- How to get value of selected page template in Gutenberg editor?
- @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
- 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
- event/callback on block update?
- can a buttongroup have a label?
- How to disable inline css styles generated by Gutenberg editor?
- 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?
- Add custom HTML markup to Gutenberg RichText
- Authentication with the Rest API when using an External Application
- How to return div with custom attributes(Coding a Gutenberg Block)
- 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
- How to add classes and events to image in javascript using Gutenberg?
- Looping over wordpress meta to create “ ‘s?
- How to display post content in the block editor
- is_front_page() variable not found
- How can I allow HTML in Gutenberg UI elements help text?
- what is the purpose of the namespace argument when customizing blocks?
- Gutenberg consume wp-json data and reflect in frontend the content
- How can I import one custom block into another?
- Gutenberg Blocks: how to determine an index of the current inner block?
- Gutenberg select excerpt, use generated excerpt or use more block excerpt
- Gutenberg dependencies in package.json
- find out reason of “Updating failed” in Post-editor
- How to render WP Rest-API Endpoints in a React.js Theme with Woocommerce
- Gutenberg RangeControl
- Custom Gutenberg block: access dom element via JavaScript
- Hook a script as the very last one before the closing body tag
- Problem extending a core block
- how to use nimble-API and Display data?
- Cannot read properties of undefined (reading ‘show_ui’) Error on WordPress Post Editor
- Add a Page Screen is Visually Blank
- Refresh Gutenberg with JS for it show updated post
- wp-api Backbone JS Client fetch options
- Including dependencies using @wordpress/dependency-extraction-webpack-plugin
- Gutenberg sidebar show input field on toggle
- Get the ID of a page in Parent combobox in editor
- Uncaught TypeError: r is not a function
- [Vue warn]: Error in render: “TypeError: Cannot read property ‘wp:featuredmedia’ of undefined – REST API
- Call javascript function when add_attachment hook fires
- Get user in rest API endpoint
- How to improve WP-Rest atrocious response time?
- How do I make a savable preview like Youtube Gutenberg block?
- I would like to retrive JSON value and display it in wordpress page or widget
- Connecting a wordpress site to an AngularJS APP
- WordPress Gutenberg: Attribute overwritten by block duplicate
- Filtering Gutenberg Components, not Blocks
- WordPress REST API response is empty in browser and script, but not in Postman
- How to delete child block for associated parent block
- WP REST API – “rest_user_cannot_view” ONLY on specific users
- Passing object to FormTokenField suggestions
- Is it possible to add javascript to template parts
- How to add a new attribute to core wp block editor without npm?
- How do i get an Inline style in Gutenberg Block show up in front end?
- WordPress adds and tags into HTML blocks after saving
- Gutenberg core/file add style support in js/ json
- Working with a non-React external library in a custom block