Filter hook 'register_meta_args'

in WP Core File wp-includes/meta.php at line 1468

View Source

register_meta_args

Filter Hook
Description
Filters the registration arguments when registering meta.

Hook Information

File Location wp-includes/meta.php View on GitHub
Hook Type Filter
Line Number 1468

Hook Parameters

Type Name Description
array $args Array of meta registration arguments.
array $defaults Array of default arguments.
string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.
string $meta_key Meta key.

Usage Examples

Basic Usage
<?php
// Hook into register_meta_args
add_filter('register_meta_args', 'my_custom_filter', 10, 4);

function my_custom_filter($args, $defaults, $object_type, $meta_key) {
    // Your custom filtering logic here
    return $args;
}

Source Code Context

wp-includes/meta.php:1468 - How this hook is used in WordPress core
<?php
1463  	 * @param array  $defaults    Array of default arguments.
1464  	 * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
1465  	 *                            or any other object type with an associated meta table.
1466  	 * @param string $meta_key    Meta key.
1467  	 */
1468  	$args = apply_filters( 'register_meta_args', $args, $defaults, $object_type, $meta_key );
1469  	unset( $defaults['default'] );
1470  	$args = wp_parse_args( $args, $defaults );
1471  
1472  	// Require an item schema when registering array meta.
1473  	if ( false !== $args['show_in_rest'] && 'array' === $args['type'] ) {

PHP Documentation

<?php
/**
	 * Filters the registration arguments when registering meta.
	 *
	 * @since 4.6.0
	 *
	 * @param array  $args        Array of meta registration arguments.
	 * @param array  $defaults    Array of default arguments.
	 * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
	 *                            or any other object type with an associated meta table.
	 * @param string $meta_key    Meta key.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/meta.php
Related Hooks

Related hooks will be displayed here in future updates.