WC_Admin_Upload_Downloadable_Product::upload_dir()
Change upload dir for downloadable files.
Method of the class: WC_Admin_Upload_Downloadable_Product{}
No Hooks.
Return
Array
.
Usage
$WC_Admin_Upload_Downloadable_Product = new WC_Admin_Upload_Downloadable_Product(); $WC_Admin_Upload_Downloadable_Product->upload_dir( $pathdata );
- $pathdata(array) (required)
- Array of paths.
WC_Admin_Upload_Downloadable_Product::upload_dir() WC Admin Upload Downloadable Product::upload dir code WC 9.6.1
public function upload_dir( $pathdata ) { // phpcs:disable WordPress.Security.NonceVerification.Missing if ( isset( $_POST['type'] ) && 'downloadable_product' === $_POST['type'] ) { if ( empty( $pathdata['subdir'] ) ) { $pathdata['path'] = $pathdata['path'] . '/woocommerce_uploads'; $pathdata['url'] = $pathdata['url'] . '/woocommerce_uploads'; $pathdata['subdir'] = '/woocommerce_uploads'; } else { $new_subdir = '/woocommerce_uploads' . $pathdata['subdir']; $pathdata['path'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['path'] ); $pathdata['url'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['url'] ); $pathdata['subdir'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['subdir'] ); } } return $pathdata; // phpcs:enable WordPress.Security.NonceVerification.Missing }