oEmbed

Improve this page

Overview

The oEmbed field creates a simple text input for entering media URL. This field offers live preview the media content. It supports many media websites.

Screenshot

oembed

Settings

Besides the common settings, this field has the following specific settings:

Name Description
size Input size. Default 30. Optional.

Sample code

array(
    'id'    => 'oembed',
    'name'  => 'oEmbed(s)',
    'type'  => 'oembed',

    // Input size
    'size'  => 30,
),

Data

This field saves the media URL in the post meta.

Template usage

To output the media in the frontend, use the rwmb_meta() helper function:

$media = rwmb_meta( $field_id );
echo $value;

This helper function will display the oembed content, e.g. if the value is a Youtube URL, it will display the full Youtube video player.

In case you want to get the URL of the field, use this code:

$url = rwmb_get_value( $field_id );
echo $url

Read more about rwmb_meta() and rwmb_get_value().