WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 1316 | * |
| 1317 | * @since 4.6.0 |
| 1318 | * |
| 1319 | * @param array $args Array of meta registration arguments. |
| 1320 | * @param array $defaults Array of default arguments. |
| 1321 | * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', |
| 1322 | * or any other object type with an associated meta table. |
| 1323 | * @param string $meta_key Meta key. |
| 1324 | */ |
| 1325 | $args = apply_filters( 'register_meta_args', $args, $defaults, $object_type, $meta_key ); |
| 1326 | unset( $defaults['default'] ); |
| 1327 | $args = wp_parse_args( $args, $defaults ); |
| 1328 | |
| 1329 | // Require an item schema when registering array meta. |
| 1330 | if ( false !== $args['show_in_rest'] && 'array' === $args['type'] ) { |
| 1331 | if ( ! is_array( $args['show_in_rest'] ) || ! isset( $args['show_in_rest']['schema']['items'] ) ) { |
| 1332 | _doing_it_wrong( __FUNCTION__, __( 'When registering an "array" meta type to show in the REST API, you must specify the schema for each array item in "show_in_rest.schema.items".' ), '5.3.0' ); |
| 1333 | |
| 1334 | return false; |