1

I'm trying to register a custom post type with a template containing a preformated h2 and h3. When I add a core/heading block, it automatically create a H2. What parameter should I add in order to have a H3?

My code looks like this:

register_post_type('custom-post', array(
  // [...]
  'template' => array(
    array(
      'core/heading',
       array(
         'placeholder' => 'this is a H2'
       )
    ),
    array(
      'core/heading',
      array(
        'heading' => '3', // this does not work
        'placeholder' => 'this should be a H3'
      )
    )
  )
));

1 Answer 1

3

Just figured out the solution: use 'level' => 3 as parameter.

register_post_type('custom-post', array(
  // [...]
  'template' => array(
    array(
      'core/heading',
      array(
        'level' => 3
        'placeholder' => 'this is a H3'
      )
    )
  )
));

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.