The Select field creates a dropdown menu input option for the block.


  • Help Text: Instructions to describe the data needed in the field.
  • Choices: The available items in the dropdown menu.
    • Enter each choice on a new line.
    • To specify the value and label separately, use this format: value : Label.
  • Default Value: The default value for this field when adding the block.

PHP API Controls

  • name
  • label
  • control
  • type
  • order
  • location
  • width
  • help
  • options
  • default

Template Usage

To use the Select field in your template, use the field name you provided.

<?php block_field( 'pets-size' ); ?>

The API will return a string.

Example template file /blocks/block-block-lab-example.php

// Block Lab Example Select Field

<p>We expect this pet will be <?php block_field( 'pets-size' ); ?> size when fully grown.</p>

To use the block with the Select field on your site, locate it in the blocks menu.

Screenshot showing the Block Lab custom block in the menu

It will then display within your post/page.

And on the front-end of your site.