Advertisement
phpface

Untitled

Aug 15th, 2022
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. add_filter( 'streamtube/core/video/download_file_url', function( $url ){
  2.  
  3.     // define your custom sub domain
  4.     $sub_domain = 'https://mysub.domain.com';
  5.  
  6.     $attachment_id = get_post_meta( get_the_ID(), 'video_url', true );
  7.  
  8.     if( ! wp_attachment_is( 'video', $attachment_id ) ){
  9.         return $url;
  10.     }
  11.  
  12.     $file_url = wp_get_attachment_url( $attachment_id );
  13.  
  14.     return str_replace( untrailingslashit( home_url() ), untrailingslashit( $sub_domain ), $file_url );
  15.  
  16. }, 100, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement