Skip to content

Instantly share code, notes, and snippets.

@wbcomdev
Created December 7, 2023 07:39
Show Gist options
  • Select an option

  • Save wbcomdev/256bb1103e5985184b7c81b547d26ebe to your computer and use it in GitHub Desktop.

Select an option

Save wbcomdev/256bb1103e5985184b7c81b547d26ebe to your computer and use it in GitHub Desktop.
Restrict instructors to upload course images of particular sizes while creating new courses
<?php
add_filter( 'ld_dashboard_course_form_fields', function( $fields ) {
if( ! empty( $fields ) ) { //First we check fields are not empty
foreach ( $fields as $key => $field ) {
if( 'field_61fcef414383d' === $fields[$key]['key'] ){
$fields[$key]['max_width'] = 600; //Provide the value of maximum with of image that would be uploaded by instructor
$fields[$key]['max_height'] = 600; //Provide the value of maximum height of image that would be uploaded by instructor
$fields[$key]['max_size'] = 600; //Provide the value of size of image that would be uploaded by instructor
}
}
}
return $fields;
} );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment