urlencode_deep

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

WordPress Version: 5.5

/**
 * Navigates through an array, object, or scalar, and encodes the values to be used in a URL.
 *
 * @since 2.2.0
 *
 * @param mixed $value The array or string to be encoded.
 * @return mixed The encoded value.
 */
function urlencode_deep($value)
{
    return map_deep($value, 'urlencode');
}

WordPress Version: 4.4

/**
 * Navigates through an array, object, or scalar, and encodes the values to be used in a URL.
 *
 * @since 2.2.0
 *
 * @param mixed $value The array or string to be encoded.
 * @return mixed $value The encoded value.
 */
function urlencode_deep($value)
{
    return map_deep($value, 'urlencode');
}

WordPress Version: 4.3

/**
 * Navigates through an array and encodes the values to be used in a URL.
 *
 *
 * @since 2.2.0
 *
 * @param array|string $value The array or string to be encoded.
 * @return array|string $value The encoded array (or string from the callback).
 */
function urlencode_deep($value)
{
    return is_array($value) ? array_map('urlencode_deep', $value) : urlencode($value);
}

WordPress Version: 3.7

/**
 * Navigates through an array and encodes the values to be used in a URL.
 *
 *
 * @since 2.2.0
 *
 * @param array|string $value The array or string to be encoded.
 * @return array|string $value The encoded array (or string from the callback).
 */
function urlencode_deep($value)
{
    $value = is_array($value) ? array_map('urlencode_deep', $value) : urlencode($value);
    return $value;
}