Support » Fixing WordPress » How to determine “name” of block

  • Resolved OsakaWebbie

    (@osakawebbie)


    I’m trying to make a block template for a custom post type. There are plenty of examples using common blocks like “core/paragraph” and “core/image”, but how can I determine the name of other blocks? In particular, I need the block supplied by the plugin “Gutenberg PDF Viewer Block”, but later I might want to know about others, so I’m hoping there is a general-purpose way to get the names.

Viewing 4 replies - 1 through 4 (of 4 total)
  • I think you have to go into the react JS or PHP file that creates the block. I don’t think there’s another way to get the name, but I’m not a Gutenberg expert…yet.

    Thread Starter OsakaWebbie

    (@osakawebbie)

    Okay, that was reasonable for that simple plugin (I followed a trail through three files until I found a likely-looking “something/something” string, which was “pdf-viewer-block/standard”), and that worked in my template.

    But what about all the blocks provided by WordPress? Presumably they all start with “core/”, but grep -R 'core/' *.php turned up nothing, and sifting through the code manually would be way too daunting for me.

    I’m not a Gutenberg expert…yet.

    I’m not sure anyone is a Gutenberg expert yet! 😉

    Hi @osakawebbie,

    For “Gutenberg PDF Viewer Block” this plugin, pdf-viewer-block/standard is the name of block

    Please follow below steps for getting name of any block

    1. add that block in your pagec(admin)
    2. open browser inspector then find “data-type” in elements
    3. now you can find all block which is used in that page
    4. like this you can find block name.

    Hope this helps you.

    Thanks.

    Thread Starter OsakaWebbie

    (@osakawebbie)

    Cool – that works great!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to determine “name” of block’ is closed to new replies.