Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getBlockTypes() do not return custom (PHP ?) blocks outside of the editor. #69214

Open
3 of 6 tasks
MarieComet opened this issue Feb 17, 2025 · 0 comments
Open
3 of 6 tasks
Labels
[Feature] Blocks Overall functionality of blocks Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended

Comments

@MarieComet
Copy link
Contributor

Description

I'm following the "Create your First App with Gutenberg Data" tutorial".

Inside the main app file, I'm using the getBlockTypes() function from the @wordpress/blocks package, and it looks like the function do not return custom blocks, or at least, blocks registered with the PHP register_block_type( $block_build_folder ) function. I get only core blocks.

If i run wp.data.select('core/blocks').getBlockTypes() in the browser console inside the Editor (edit page screen for example), I got all the blocks, including customs blocks and PHP registered blocks.

Step-by-step reproduction instructions

You must have a custom block, registered in PHP, activated on your site.

  1. Clone the App example from the tutorial inside your plugins folder.
  2. Open the terminal inside the cloned folder and run npm install then npm run build
  3. Activate the "Block Development Examples - Data Basics 59c8f8" plugin in your dashboard
  4. Go to the "My custom Gutenberg app" admin page (/wp-admin/admin.php?page=my-custom-gutenberg-app)
  5. Open your browser console and paste wp.data.select('core/blocks').getBlockTypes()
  6. See in the results list that your custom block is missing.

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 6.7.1
  • 2025 theme

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@MarieComet MarieComet added the [Type] Bug An existing feature does not function as intended label Feb 17, 2025
@t-hamano t-hamano added [Feature] Blocks Overall functionality of blocks Needs Testing Needs further testing to be confirmed. labels Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants