Improve this page


The video field uses WordPress media popup for selecting / uploading videos.




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

Name Description
max_file_uploads Max number of uploaded videos. Optional.
force_delete Whether or not delete the videos from Media Library when deleting them from post meta (true or false)? Optional. Default false.
max_status Display how many videos uploaded/remaining. Applied only when max_file_uploads is defined. true (default) or false. Optional.

Sample code

    'name'             => 'Video',
    'id'               => 'field_id',
    'type'             => 'video',

    // Maximum video uploads. 0 = unlimited.
    'max_file_uploads' => 3,

    // Delete videos from Media Library when remove it from post meta?
    // Note: it might affect other posts if you use same videos for multiple posts
    'force_delete'     => false,

    // Display the "Uploaded 1/3 videos" status
    'max_status'       => true,


Similar to file field, this field saves multiple values (video attachment IDs) in the database. Each value (video attachment ID) and is store in a single row in the database with the same meta key (similar to what add_post_meta does with last parameter false).

Template usage

To get the uploaded videos, use the helper function rwmb_meta():

$videos = rwmb_meta( 'field_id' );
foreach ( $videos as $video ) {
    <video src="<?php echo $video['src']; ?>">

This helper function returns an array of videos, each video has the following information:

    'ID'          => 123,
    'src'         => '',
    'title'       => 'Introduction',
    'type'        => 'video',
    'caption'     => 'Video caption',
    'description' => 'Video description',

    // Array of video ID3 meta. See
    'meta'        => array(),

    // Video dimension.
    'dimensions'  => array(
        'width'  => 640,
        'height' => 360,

    // Featured image: full size
    'image'       => array(
        'src'    =>',
        'width'  => 1024,
        'height' => 500',

    // Featured image: thumbnail
    'thumb'       => array(
        'src'    =>',
        'width'  => 150,
        'height' => 150',

In case you want to get only 1 video, use the limit parameter for the helper function:

$videos = rwmb_meta( 'field_id', array( 'limit' => 1 ) );
$video = reset( $videos );
<video src="<?php echo $video['src']; ?>">

If you only want to display uploaded videos in a player (with playlist), you can just use the rwmb_the_value():

rwmb_the_value( $field_id );

If you want to output the video player for each single uploaded video, then you can use this code:

$videos = rwmb_meta( 'field_id' );
foreach ( $videos as $video ) {
    echo wp_video_shortcode( array(
        'src'    => $video['src'],
        'width'  => $video['dimensions']['width'],
        'height' => $video['dimensions']['height'],
    ) );

Read more about rwmb_meta(), rwmb_the_value() and wp_video_shortcode().