The URL field creates a simple text input that only accepts valid URLs.


  • Help Text: Instructions to describe the data needed in the field.
  • Default Value: The default value for this field when adding the block.
  • Placeholder Text: The helper text which appears in the field when the input is empty.

PHP API Controls

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

Template Usage

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

<a href="<?php block_field( 'owners-website' ); ?>" />

The API will return a string.

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

// Block Lab Example URL Field

<p>Find more info about this pet on the <a href="<?php block_field( 'owners-website' ); ?>" />current owner's website.</a></p>

To use the block with the URL 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.