• Hello everyone,

    I’m trying to learn block development in wordpress, and I have installed locally with Local and I followed the guides here on WordPress. I created the plugin, and everything looks good on VS Code. Only problem is that when I go create a page, the option for the block is not showing up. How do I fix this?

    Block.json File:

    {

    "$schema": "https://schemas.wp.org/trunk/block.json",

    "apiVersion": 3,

    "name": "create-block/wp-learn-todo",

    "version": "0.1.0",

    "title": "Wp Learn Todo",

    "category": "widgets",

    "icon": "smiley",

    "description": "Example block scaffolded with Create Block tool.",

    "example": {},

    "supports": {

    "html": false

    },

    "textdomain": "wp-learn-todo",

    "editorScript": "file:./index.js",

    "editorStyle": "file:./index.css",

    "style": "file:./style-index.css",

    "viewScript": "file:./view.js"

    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Did you use @wordpress/create-block to create it? Then there was a bug there until recently, see: https://github.com/WordPress/gutenberg/issues/62202 – it seems to have been solved in the meantime, but have a look at the issue there.

    Hello @andrecpe15 ,

    I recently encountered a similar issue! If you used the @wordpress/create-block package to generate your block files, registration should work without issues. Here’s a potential solution:

    1. Try updating WordPress to the latest version or clearing your cache!

    If you manually created the block files, I recommend comparing your structure with the default one generated by @wordpress/create-block. Ensure everything matches, and also double-check that you’re correctly registering the block using register_block_type() .

    <?php
    function my_custom_block_init() {
    // Register the block using the block.json file or directly specify attributes.
    register_block_type( DIR . '/build' );
    }
    add_action( 'init', 'my_custom_block_init' );

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.