_validate_cache_id

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

WordPress Version: 6.3

/**
 * Checks whether the given cache ID is either an integer or an integer-like string.
 *
 * Both `16` and `"16"` are considered valid, other numeric types and numeric strings
 * (`16.3` and `"16.3"`) are considered invalid.
 *
 * @since 6.3.0
 *
 * @param mixed $object_id The cache ID to validate.
 * @return bool Whether the given $object_id is a valid cache ID.
 */
function _validate_cache_id($object_id)
{
    /*
     * filter_var() could be used here, but the `filter` PHP extension
     * is considered optional and may not be available.
     */
    if (is_int($object_id) || is_string($object_id) && (string) (int) $object_id === $object_id) {
        return true;
    }
    /* translators: %s: The type of the given object ID. */
    $message = sprintf(__('Object ID must be an integer, %s given.'), gettype($object_id));
    _doing_it_wrong('_get_non_cached_ids', $message, '6.3.0');
    return false;
}