wc_get_filename_from_url

Gets the filename part of a download URL.

Description

(string) wc_get_filename_from_url( (string) $file_url ); 

Returns (string)

Parameters (1)

0. $file_url (string)
The file url.

Usage

  1. if ( !function_exists( 'wc_get_filename_from_url' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-formatting-functions.php'; 
  3.  
  4. // The file url. 
  5. $file_url = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_get_filename_from_url($file_url); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-formatting-functions.php  
  1. function wc_get_filename_from_url( $file_url ) { 
  2. $parts = parse_url( $file_url ); 
  3. if ( isset( $parts['path'] ) ) { 
  4. return basename( $parts['path'] );