Title: WP_REST_Meta_Fields::register_field
Published: December 6, 2016
Last modified: May 20, 2026

---

# WP_REST_Meta_Fields::register_field()

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#see-also)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#wp--skip-link--target)

This method has been deprecated since 5.6.0. Use [register_rest_field()](https://developer.wordpress.org/reference/functions/register_rest_field/)
instead.

Registers the meta field.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#see-also)󠁿

 * [register_rest_field()](https://developer.wordpress.org/reference/functions/register_rest_field/)

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#source)󠁿

    ```php
    public function register_field() {
    	_deprecated_function( __METHOD__, '5.6.0' );

    	register_rest_field(
    		$this->get_rest_field_type(),
    		'meta',
    		array(
    			'get_callback'    => array( $this, 'get_value' ),
    			'update_callback' => array( $this, 'update_value' ),
    			'schema'          => $this->get_field_schema(),
    		)
    	);
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php#L56)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php#L56-L68)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#related)󠁿

| Uses | Description | 
| [register_rest_field()](https://developer.wordpress.org/reference/functions/register_rest_field/)`wp-includes/rest-api.php` |

Registers a new field on an existing WordPress object type.

  | 
| [WP_REST_Meta_Fields::get_field_schema()](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/get_field_schema/)`wp-includes/rest-api/fields/class-wp-rest-meta-fields.php` |

Retrieves the object’s meta schema, conforming to JSON Schema.

  | 
| [WP_REST_Meta_Fields::get_rest_field_type()](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/get_rest_field_type/)`wp-includes/rest-api/fields/class-wp-rest-meta-fields.php` |

Retrieves the object type for [register_rest_field()](https://developer.wordpress.org/reference/functions/register_rest_field/) .

  | 
| [_deprecated_function()](https://developer.wordpress.org/reference/functions/_deprecated_function/)`wp-includes/functions.php` |

Marks a function as deprecated and inform when it has been used.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_meta_fields/register_field/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Deprecated.  | 
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_meta_fields%2Fregister_field%2F)
before being able to contribute a note or feedback.