I tried to find any hook to restrict the user to upload the featured image only in the expected aspect ratio but I couldn't but it's done by jQuery and wp.media library, first I checked the image ratio with jquery and then use below code to open image editor popup to edit the image, here is my code snippet:-
$(document).on('click','#edit-thumb-ratio',function(e){
e.preventDefault();
feature_uploader = wp.media.featuredImage.frame();
feature_uploader.on('open', function() {
var selection = feature_uploader.state().get('selection');
$('.media-frame-content').append('<div class="imgedit-wait" id=""></div>')
// //remove all the selection first
selection.each(function(image) {
var attachment = wp.media.attachment( image.attributes.id );
attachment.fetch();
selection.remove( attachment ? [ attachment ] : [] );
});
// //add back current selection, in here let us assume you attach all the [id] to <div id="my_file_group_field">...<input type="hidden" id="file_1" .../>...<input type="hidden" id="file_2" .../>
$("#postimagediv").find('input[type="hidden"]').each(function(){
var input_id = $(this);
if( input_id.val() ){
attachment = wp.media.attachment( input_id.val() );
attachment.fetch();
selection.add( attachment ? [ attachment ] : [] );
}
});
$('.imgedit-wait').show();
setTimeout(function(){
$('.attachment-info .edit-attachment').trigger('click');
},1000);
});
feature_uploader.on('select', function() {
delete feature_uploader;
});
feature_uploader.open();
});