Using apiFetch for retrieving post data in Gutenberg
In a plugin I’m developing, I registered a custom REST API route to get some post data passing a post id:
In a plugin I’m developing, I registered a custom REST API route to get some post data passing a post id:
In Gutenberg there’s the getEntityRecord selector that allows you to get the data of a post of a specific post type:
I have a custom block that needs a URL attribute. I figured it made sense to set the URL in the sidebar or the toolbar, but I can’t find a way to do it. I’ve tried:
I disabled Gutenberg web builder/ editor using the following code:
In a plugin I’m building for Gutenberg, I register a meta field named _related_posts, which stores an array of post ids:
I use the useSelect hook to retrieve data from the database when developing for the block editor.
I’m developing a plugin that registers a PluginDocumentSettingPanel in Gutenberg. As this is not a block, I cannot use the register_block_type function to add its assets, so I have to employ the enqueue_block_editor_assets action in its place.
For the core/paragraph-Block, I would like to register a custom style. This is working fine with
I’m developing a Gutenberg block and I need to show a dropdown with all the terms of a custom taxonomy in it. I’m using the useSelect hook for retrieving this data, but it’s not working because it gets stuck showing the Loading... message and there are no errors in the console. I registered the taxonomy with the show_in_rest arg set to true.
I’m checking posts for a custom block and trying to render the content of those blocks elsewhere in the site via PHP. My method for doing that looks like this: