get_oembed_response_data example

/** * Filters the determined post ID. * * @since 4.4.0 * * @param int $post_id The post ID. * @param string $url The requested URL. */
        $post_id = apply_filters( 'oembed_request_post_id', $post_id$request['url'] );

        $data = get_oembed_response_data( $post_id$request['maxwidth'] );

        if ( ! $data ) {
            return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) );
        }

        return $data;
    }

    /** * Checks if current user can make a proxy oEmbed request. * * @since 4.8.0 * * @return true|WP_Error True if the request has read access, WP_Error object otherwise. */
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;
}


/** * Filters the oEmbed response data to return an iframe embed code. * * @since 4.4.0 * * @param array $data The response data. * @param WP_Post $post The post object. * @param int $width The requested width. * @param int $height The calculated height. * @return array The modified response data. */
Home | Imprint | This part of the site doesn't use cookies.