wp_oembed_get

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

WordPress Version: 5.7

/**
 * Attempts to fetch the embed HTML for a provided URL using oEmbed.
 *
 * @since 2.9.0
 *
 * @see WP_oEmbed
 *
 * @param string $url  The URL that should be embedded.
 * @param array|string $args {
 *     Optional. Additional arguments for retrieving embed HTML. Default empty.
 *
 *     @type int|string $width    Optional. The `maxwidth` value passed to the provider URL.
 *     @type int|string $height   Optional. The `maxheight` value passed to the provider URL.
 *     @type bool       $discover Optional. Determines whether to attempt to discover link tags
 *                                at the given URL for an oEmbed provider when the provider URL
 *                                is not found in the built-in providers list. Default true.
 * }
 * @return string|false The embed HTML on success, false on failure.
 */
function wp_oembed_get($url, $args = '')
{
    $oembed = _wp_oembed_get_object();
    return $oembed->get_html($url, $args);
}

WordPress Version: 5.6

/**
 * Attempts to fetch the embed HTML for a provided URL using oEmbed.
 *
 * @since 2.9.0
 *
 * @see WP_oEmbed
 *
 * @param string $url  The URL that should be embedded.
 * @param array  $args {
 *     Optional. Additional arguments for retrieving embed HTML. Default empty.
 *
 *     @type int|string $width    Optional. The `maxwidth` value passed to the provider URL.
 *     @type int|string $height   Optional. The `maxheight` value passed to the provider URL.
 *     @type bool       $discover Optional. Determines whether to attempt to discover link tags
 *                                at the given URL for an oEmbed provider when the provider URL
 *                                is not found in the built-in providers list. Default true.
 * }
 * @return string|false The embed HTML on success, false on failure.
 */
function wp_oembed_get($url, $args = '')
{
    $oembed = _wp_oembed_get_object();
    return $oembed->get_html($url, $args);
}

WordPress Version: 5.4

/**
 * Attempts to fetch the embed HTML for a provided URL using oEmbed.
 *
 * @since 2.9.0
 *
 * @see WP_oEmbed
 *
 * @param string $url  The URL that should be embedded.
 * @param array  $args Optional. Additional arguments and parameters for retrieving embed HTML.
 *                     Default empty.
 * @return string|false The embed HTML on success, false on failure.
 */
function wp_oembed_get($url, $args = '')
{
    $oembed = _wp_oembed_get_object();
    return $oembed->get_html($url, $args);
}

WordPress Version: 4.7

/**
 * Attempts to fetch the embed HTML for a provided URL using oEmbed.
 *
 * @since 2.9.0
 *
 * @see WP_oEmbed
 *
 * @param string $url  The URL that should be embedded.
 * @param array  $args Optional. Additional arguments and parameters for retrieving embed HTML.
 *                     Default empty.
 * @return false|string False on failure or the embed HTML on success.
 */
function wp_oembed_get($url, $args = '')
{
    $oembed = _wp_oembed_get_object();
    return $oembed->get_html($url, $args);
}

WordPress Version: 4.2

/**
 * Attempts to fetch the embed HTML for a provided URL using oEmbed.
 *
 * @since 2.9.0
 *
 * @see WP_oEmbed
 *
 * @param string $url  The URL that should be embedded.
 * @param array  $args Optional. Additional arguments and parameters for retrieving embed HTML.
 *                     Default empty.
 * @return false|string False on failure or the embed HTML on success.
 */
function wp_oembed_get($url, $args = '')
{
    require_once ABSPATH . WPINC . '/class-oembed.php';
    $oembed = _wp_oembed_get_object();
    return $oembed->get_html($url, $args);
}

WordPress Version: 4.1

/**
 * Attempts to fetch the embed HTML for a provided URL using oEmbed.
 *
 * @since 2.9.0
 * @see WP_oEmbed
 *
 * @param string $url The URL that should be embedded.
 * @param array $args Additional arguments and parameters.
 * @return false|string False on failure or the embed HTML on success.
 */
function wp_oembed_get($url, $args = '')
{
    require_once ABSPATH . WPINC . '/class-oembed.php';
    $oembed = _wp_oembed_get_object();
    return $oembed->get_html($url, $args);
}

WordPress Version: 3.7

/**
 * Attempts to fetch the embed HTML for a provided URL using oEmbed.
 *
 * @since 2.9.0
 * @see WP_oEmbed
 *
 * @uses _wp_oembed_get_object()
 * @uses WP_oEmbed::get_html()
 *
 * @param string $url The URL that should be embedded.
 * @param array $args Additional arguments and parameters.
 * @return bool|string False on failure or the embed HTML on success.
 */
function wp_oembed_get($url, $args = '')
{
    require_once ABSPATH . WPINC . '/class-oembed.php';
    $oembed = _wp_oembed_get_object();
    return $oembed->get_html($url, $args);
}