function imnobby_regenerate_thumbnail_by_attachment_id($image_id=""){
    
    if ( empty($image_id) ){
        exit;
    }
    
    $image_meta = wp_get_attachment_metadata($image_id);
    $filename = wp_upload_dir()["basedir"] . "/".$image_meta["file"];
    $generate_image = wp_generate_attachment_metadata( $image_id, $filename );
    
}
Related Keywords: Developer, How-to, Solved, Regenerate Thumbnail Programmatically, functions.php, Hook, API