Skip to content

Instantly share code, notes, and snippets.

@gdarko
Created June 1, 2021 21:25
Show Gist options
  • Save gdarko/f6627f9604ba96bb04951b248fc5cc78 to your computer and use it in GitHub Desktop.
Save gdarko/f6627f9604ba96bb04951b248fc5cc78 to your computer and use it in GitHub Desktop.
WP Vimeo Videos - Modify video title before upload (both Vimeo.com and Local video title)
<?php
/**
* Append date to the video title stored in Media > Library
*
* @param $args
*
* @return mixed
*/
function dgv_before_create_local_video_params_823842831( $args ) {
$args['post_title'] = sprintf( '%s - %s', $args['post_title'], wp_date( get_option( 'date_format' ) ) );
return $args;
}
add_filter( 'dgv_before_create_local_video_params', 'dgv_before_create_local_video_params_823842831', 20 );
/**
* Append date to the video title stored in Vimeo.com
*
* @param $args
*
* @return mixed
*/
function dgv_before_create_api_video_params_823842831( $args ) {
$args['name'] = sprintf( '%s - %s', $args['name'], wp_date( get_option( 'date_format' ) ) );
return $args;
}
add_filter( 'dgv_before_create_api_video_params', 'dgv_before_create_api_video_params_823842831', 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment