WC_Admin_Post_Types::update_filename( string $full_filename, string $ext, string $dir )
Change filename for WooCommerce uploads and prepend unique chars for security.
Description Description
Parameters Parameters
- $full_filename
-
(Required) Original filename.
- $ext
-
(Required) Extension of file.
- $dir
-
(Required) Directory path.
Return Return
(string) New filename with unique hash.
Source Source
File: includes/admin/class-wc-admin-post-types.php
public function update_filename( $full_filename, $ext, $dir ) { if ( ! isset( $_POST['type'] ) || ! 'downloadable_product' === $_POST['type'] ) { // WPCS: CSRF ok, input var ok. return $full_filename; } if ( ! strpos( $dir, 'woocommerce_uploads' ) ) { return $full_filename; } if ( 'no' === get_option( 'woocommerce_downloads_add_hash_to_filename' ) ) { return $full_filename; } return $this->unique_filename( $full_filename, $ext ); }
Changelog Changelog
Version | Description |
---|---|
4.0 | Introduced. |