Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Last active April 29, 2019 09:16
Show Gist options
  • Save plugin-republic/48854d8510eb3e65f011b85aeab3450d to your computer and use it in GitHub Desktop.
Save plugin-republic/48854d8510eb3e65f011b85aeab3450d to your computer and use it in GitHub Desktop.
<?php
/**
* @param $multiple '' | 'multiple'
* @param $product_id Product ID
* @param $id Field ID
*/
// Enable multiple uploads for all file inputs
function prefix_filter_multiple( $multiple, $product_id, $id ) {
return 'multiple';
}
add_filter( 'pewc_allow_multiple_file_upload', 'prefix_filter_multiple', 10, 3 );
// Enable multiple file uploads by product ID
function prefix_filter_multiple_by_id( $multiple, $product_id, $id ) {
if( $product_id == 99 ) {
return 'multiple';
}
return $multiple;
}
add_filter( 'pewc_allow_multiple_file_upload', 'prefix_filter_multiple_by_id', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment