I have been searching for a day and still carn't seem to find the right documentation for what arguments I can pass to core components when attempting to configure a CPT block template in php. This is what I have but I want to take this further by nesting buttons and custom html etc. but carnt find the docs I need.

'template' => array(
    array( 'core/columns', array(), array(
        array( 'core/column', array("width" => "60"), array(
            array( 'core/image', array() ),
        ) ),
        array( 'core/column', array("width" => "40"), array(
            array( 'core/image', array() ),
            array( 'core/heading', array(
                'placeholder' => 'Add a inner paragraph'
            ) ),
        ) ),

Found everything needed to create bespoke blocks in JSX but blegh, Not got the time to learn the wizardry ways of JSX just yet and I dont really want new blocks just want the existing one bound as a template to a custom post type.

A good way to example my question, how did this person find the answer on how set the width of this template columns.

How to set column widths in a CPT block template?

How did the person find this answer ? did they have to dive in to the JS scripts of the component and work it out or is there some documentation on this or am I missing something all together.

Any help would be greatly appreciated.

  • My understanding is that it should take the same format as doing it in JS, then you would directly translate it from JS to PHP in a very literal way, e.g. array() becomes [] ( note that [] is valid in modern PHP versions )
    – Tom J Nowell
    Commented Jun 27, 2020 at 15:18

1 Answer 1


You can't find that documentation because it doesn't exist. It doesn't exist because that's not how it works, and it would require extensive duplication to set up.

So to figure out what you need to put, figure out what it is in Javascript/JSON, then translate it to PHP.

The pattern is:

    'block name'
        'parameter': 'value'
        .... etc
    [ .... child blocks ... ]

Which brings us to why there is no doc that explicitly mentions these parameters for PHP. Those parameters aren't defined in PHP, they're defined by the blocks themselves, and the blocks are built in javascript. So you won't find a list of parameters for use in PHP block templates, because there isn't one, and it would not make sense to make one. That's not how it works.

So, build your blocks in the block editor, look at their parameters, then write them in in PHP.

A good way to example my question, how did this person find the answer on how set the width of this template columns.

By inspecting the blocks in the editor to see what the parameters of the block were, and what their values were.

  • 1
    Thanks Tom, you the man. Makes perfect sense. Guess I'll have to start getting familiar with the Javascript side of things to master it but should be able to get away with just replicating the attributes from the block editor. Thanks a bunch.
    – Johnny
    Commented Jun 27, 2020 at 15:31
  • You can also look at the saved markup, the HTML comments demarcatiing the start and end of blocks can contain the attributes too
    – Tom J Nowell
    Commented Jun 27, 2020 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.