$img_path = '~/img/file.png'; $gd_image_editor = new WP_Image_Editor_GD($img_path); $gd_image_editor->load(); $gd_image_editor->rotate(90); $gd_image_editor->save($img_path);