get_oembed_response_data_for_url

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

WordPress Version: .10

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 5.5

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 4.3

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 4.2

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: .10

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 5.4

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 3.5

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 3.2

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && (int) $site->blog_id !== get_current_blog_id()) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: .10

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 5.3

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && (int) $site->blog_id !== get_current_blog_id()) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 2.8

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 2.3

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && (int) $site->blog_id !== get_current_blog_id()) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: .20

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 2.2

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && (int) $site->blog_id !== get_current_blog_id()) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: .10

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 5.2

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && (int) $site->blog_id !== get_current_blog_id()) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 1.7

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 1.2

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && (int) $site->blog_id !== get_current_blog_id()) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: .10

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/', 'update_site_meta_cache' => false);
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 0.3

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/');
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && (int) $site->blog_id !== get_current_blog_id()) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: .20

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/');
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 0.2

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/');
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && (int) $site->blog_id !== get_current_blog_id()) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: .11

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/');
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        // Do not allow embeds for deleted/archived/spam sites.
        if (!empty($site->deleted) || !empty($site->spam) || !empty($site->archived)) {
            return false;
        }
        if ($site && get_current_blog_id() !== (int) $site->blog_id) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}

WordPress Version: 5.0

/**
 * Retrieves the oEmbed response data for a given URL.
 *
 * @since 5.0.0
 *
 * @param string $url  The URL that should be inspected for discovery `<link>` tags.
 * @param array  $args oEmbed remote get arguments.
 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
 */
function get_oembed_response_data_for_url($url, $args)
{
    $switched_blog = false;
    if (is_multisite()) {
        $url_parts = wp_parse_args(wp_parse_url($url), array('host' => '', 'path' => '/'));
        $qv = array('domain' => $url_parts['host'], 'path' => '/');
        // In case of subdirectory configs, set the path.
        if (!is_subdomain_install()) {
            $path = explode('/', ltrim($url_parts['path'], '/'));
            $path = reset($path);
            if ($path) {
                $qv['path'] = get_network()->path . $path . '/';
            }
        }
        $sites = get_sites($qv);
        $site = reset($sites);
        if ($site && (int) $site->blog_id !== get_current_blog_id()) {
            switch_to_blog($site->blog_id);
            $switched_blog = true;
        }
    }
    $post_id = url_to_postid($url);
    /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
    $post_id = apply_filters('oembed_request_post_id', $post_id, $url);
    if (!$post_id) {
        if ($switched_blog) {
            restore_current_blog();
        }
        return false;
    }
    $width = isset($args['width']) ? $args['width'] : 0;
    $data = get_oembed_response_data($post_id, $width);
    if ($switched_blog) {
        restore_current_blog();
    }
    return $data ? (object) $data : false;
}