_wp_register_meta_args_whitelist

The timeline below displays how wordpress function _wp_register_meta_args_whitelist has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * Filters out `register_meta()` args based on an allowed list.
 *
 * `register_meta()` args may change over time, so requiring the allowed list
 * to be explicitly turned off is a warranty seal of sorts.
 *
 * @access private
 * @since 4.6.0
 * @deprecated 5.5.0 Use _wp_register_meta_args_allowed_list() instead.
 *                   Please consider writing more inclusive code.
 *
 * @param array $args         Arguments from `register_meta()`.
 * @param array $default_args Default arguments for `register_meta()`.
 * @return array Filtered arguments.
 */
function _wp_register_meta_args_whitelist($args, $default_args)
{
    _deprecated_function(__FUNCTION__, '5.5.0', '_wp_register_meta_args_allowed_list()');
    return _wp_register_meta_args_allowed_list($args, $default_args);
}

WordPress Version: 5.4

/**
 * Filters out `register_meta()` args based on a whitelist.
 *
 * `register_meta()` args may change over time, so requiring the whitelist
 * to be explicitly turned off is a warranty seal of sorts.
 *
 * @access private
 * @since 4.6.0
 *
 * @param array $args         Arguments from `register_meta()`.
 * @param array $default_args Default arguments for `register_meta()`.
 * @return array Filtered arguments.
 */
function _wp_register_meta_args_whitelist($args, $default_args)
{
    return array_intersect_key($args, $default_args);
}

WordPress Version: 9.8

/**
 * Filter out `register_meta()` args based on a whitelist.
 * `register_meta()` args may change over time, so requiring the whitelist
 * to be explicitly turned off is a warranty seal of sorts.
 *
 * @access private
 * @since 4.6.0
 *
 * @param array $args         Arguments from `register_meta()`.
 * @param array $default_args Default arguments for `register_meta()`.
 *
 * @return array Filtered arguments.
 */
function _wp_register_meta_args_whitelist($args, $default_args)
{
    return array_intersect_key($args, $default_args);
}

WordPress Version: 9.3

/**
 * Filter out `register_meta()` args based on a whitelist.
 * `register_meta()` args may change over time, so requiring the whitelist
 * to be explicitly turned off is a warranty seal of sorts.
 *
 * @access private
 * @since  4.6.0
 *
 * @param  array $args         Arguments from `register_meta()`.
 * @param  array $default_args Default arguments for `register_meta()`.
 *
 * @return array Filtered arguments.
 */
function _wp_register_meta_args_whitelist($args, $default_args)
{
    $whitelist = array_keys($default_args);
    // In an anonymous function world, this would be better as an array_filter()
    foreach ($args as $key => $value) {
        if (!in_array($key, $whitelist)) {
            unset($args[$key]);
        }
    }
    return $args;
}

WordPress Version: .20

/**
 * Filter out `register_meta()` args based on a whitelist.
 * `register_meta()` args may change over time, so requiring the whitelist
 * to be explicitly turned off is a warranty seal of sorts.
 *
 * @access private
 * @since 4.6.0
 *
 * @param array $args         Arguments from `register_meta()`.
 * @param array $default_args Default arguments for `register_meta()`.
 *
 * @return array Filtered arguments.
 */
function _wp_register_meta_args_whitelist($args, $default_args)
{
    return array_intersect_key($args, $default_args);
}

WordPress Version: 9.2

/**
 * Filter out `register_meta()` args based on a whitelist.
 * `register_meta()` args may change over time, so requiring the whitelist
 * to be explicitly turned off is a warranty seal of sorts.
 *
 * @access private
 * @since  4.6.0
 *
 * @param  array $args         Arguments from `register_meta()`.
 * @param  array $default_args Default arguments for `register_meta()`.
 *
 * @return array Filtered arguments.
 */
function _wp_register_meta_args_whitelist($args, $default_args)
{
    $whitelist = array_keys($default_args);
    // In an anonymous function world, this would be better as an array_filter()
    foreach ($args as $key => $value) {
        if (!in_array($key, $whitelist)) {
            unset($args[$key]);
        }
    }
    return $args;
}

WordPress Version: .10

/**
 * Filter out `register_meta()` args based on a whitelist.
 * `register_meta()` args may change over time, so requiring the whitelist
 * to be explicitly turned off is a warranty seal of sorts.
 *
 * @access private
 * @since 4.6.0
 *
 * @param array $args         Arguments from `register_meta()`.
 * @param array $default_args Default arguments for `register_meta()`.
 *
 * @return array Filtered arguments.
 */
function _wp_register_meta_args_whitelist($args, $default_args)
{
    return array_intersect_key($args, $default_args);
}

WordPress Version: 4.6

/**
 * Filter out `register_meta()` args based on a whitelist.
 * `register_meta()` args may change over time, so requiring the whitelist
 * to be explicitly turned off is a warranty seal of sorts.
 *
 * @access private
 * @since  4.6.0
 *
 * @param  array $args         Arguments from `register_meta()`.
 * @param  array $default_args Default arguments for `register_meta()`.
 *
 * @return array Filtered arguments.
 */
function _wp_register_meta_args_whitelist($args, $default_args)
{
    $whitelist = array_keys($default_args);
    // In an anonymous function world, this would be better as an array_filter()
    foreach ($args as $key => $value) {
        if (!in_array($key, $whitelist)) {
            unset($args[$key]);
        }
    }
    return $args;
}