get_oembed_endpoint_url

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

WordPress Version: 4.7

/**
 * Retrieves the oEmbed endpoint URL for a given permalink.
 *
 * Pass an empty string as the first argument to get the endpoint base URL.
 *
 * @since 4.4.0
 *
 * @param string $permalink Optional. The permalink used for the `url` query arg. Default empty.
 * @param string $format    Optional. The requested response format. Default 'json'.
 * @return string The oEmbed endpoint URL.
 */
function get_oembed_endpoint_url($permalink = '', $format = 'json')
{
    $url = rest_url('oembed/1.0/embed');
    if ('' !== $permalink) {
        $url = add_query_arg(array('url' => urlencode($permalink), 'format' => ('json' !== $format) ? $format : false), $url);
    }
    /**
     * Filters the oEmbed endpoint URL.
     *
     * @since 4.4.0
     *
     * @param string $url       The URL to the oEmbed endpoint.
     * @param string $permalink The permalink used for the `url` query arg.
     * @param string $format    The requested response format.
     */
    return apply_filters('oembed_endpoint_url', $url, $permalink, $format);
}

WordPress Version: 4.6

/**
 * Retrieves the oEmbed endpoint URL for a given permalink.
 *
 * Pass an empty string as the first argument to get the endpoint base URL.
 *
 * @since 4.4.0
 *
 * @param string $permalink Optional. The permalink used for the `url` query arg. Default empty.
 * @param string $format    Optional. The requested response format. Default 'json'.
 * @return string The oEmbed endpoint URL.
 */
function get_oembed_endpoint_url($permalink = '', $format = 'json')
{
    $url = rest_url('oembed/1.0/embed');
    if ('json' === $format) {
        $format = false;
    }
    if ('' !== $permalink) {
        $url = add_query_arg(array('url' => urlencode($permalink), 'format' => $format), $url);
    }
    /**
     * Filters the oEmbed endpoint URL.
     *
     * @since 4.4.0
     *
     * @param string $url       The URL to the oEmbed endpoint.
     * @param string $permalink The permalink used for the `url` query arg.
     * @param string $format    The requested response format.
     */
    return apply_filters('oembed_endpoint_url', $url, $permalink, $format);
}

WordPress Version: 4.4

/**
 * Retrieves the oEmbed endpoint URL for a given permalink.
 *
 * Pass an empty string as the first argument to get the endpoint base URL.
 *
 * @since 4.4.0
 *
 * @param string $permalink Optional. The permalink used for the `url` query arg. Default empty.
 * @param string $format    Optional. The requested response format. Default 'json'.
 * @return string The oEmbed endpoint URL.
 */
function get_oembed_endpoint_url($permalink = '', $format = 'json')
{
    $url = rest_url('oembed/1.0/embed');
    if ('json' === $format) {
        $format = false;
    }
    if ('' !== $permalink) {
        $url = add_query_arg(array('url' => urlencode($permalink), 'format' => $format), $url);
    }
    /**
     * Filter the oEmbed endpoint URL.
     *
     * @since 4.4.0
     *
     * @param string $url       The URL to the oEmbed endpoint.
     * @param string $permalink The permalink used for the `url` query arg.
     * @param string $format    The requested response format.
     */
    return apply_filters('oembed_endpoint_url', $url, $permalink, $format);
}