Make WordPress Core


Ignore:
Timestamp:
09/16/2024 11:31:17 AM (15 months ago)
Author:
gziolo
Message:

Meta: Add label argument to register_meta function

With the introduction of Block Bindings, it became more common to see workflows where users need to see the custom fields that are available or connected. They were relying on the meta key, however it feelt too technical sometimes. The solution is adding a new label argument to include a human-readable name that can be used across the UI.

Props santosguillamot, mamaduka, gziolo, timothyblynjacobs, peterwilsoncc.
Fixes #61998.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php

    r58831 r59023  
    479479            $default_schema = array(
    480480                'type'        => $default_args['type'],
     481                'title'       => empty( $args['label'] ) ? '' : $args['label'],
    481482                'description' => empty( $args['description'] ) ? '' : $args['description'],
    482483                'default'     => isset( $args['default'] ) ? $args['default'] : null,
Note: See TracChangeset for help on using the changeset viewer.