• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Jetpack a2z

Jetpack a2z

Jetpack a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / VideoPress_XMLRPC::create_media_item() – This is used by the WPCOM VideoPress uploader in order to create a media item with specific meta data about an uploaded file. After this, the transcoding session will update the meta information via the update_videopress_media_item() method.

You appear to be a bot. Output may be restricted

Description

This is used by the WPCOM VideoPress uploader in order to create a media item with specific meta data about an uploaded file. After this, the transcoding session will update the meta information via the update_videopress_media_item() method.

Note: This method technically handles the creation of multiple media objects, though in practice this is never done.

Usage

$array = VideoPress_XMLRPC::create_media_item( $media );

Parameters

$media
( array ) required –

Returns

array

Source

File name: jetpack/modules/videopress/class.videopress-xmlrpc.php


Lines:

1 to 24 of 24
  public function create_media_item( $media ) {
    $this->authenticate_user();

    foreach ( $media as & $media_item ) {
      $title = sanitize_title( basename( $media_item['url'] ) );
      $guid  = isset( $media['guid'] ) ? $media['guid'] : null;

      $media_id = videopress_create_new_media_item( $title, $guid );

      wp_update_attachment_metadata(
        $media_id,
        array(
          'original' => array(
            'url' => $media_item['url'],
          ),
        )
      );

      $media_item['post'] = get_post( $media_id );
    }

    return array( 'media' => $media );
  }
 

 View on GitHub View on Trac

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Related

Published: 27 November 2019 | Last updated: 10 December 2020

Primary Sidebar

Information

Function name: VideoPress_XMLRPC::create_media_item
Class ref: VideoPress_XMLRPC
Plugin ref: Jetpack
Version: 9.2
Sourcefile: modules/videopress/class.videopress-xmlrpc.php
File ref: modules/videopress/class.videopress-xmlrpc.php
Deprecated?: No
API Letters: C,I,M,V,X

Footer

Jetpack a2z
Jetpack a2z
Jetpack a2z
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  jetpack.wp-a2z.org
© Copyright Jetpack a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites