| @@ -1586,8 +1586,12 @@ | ||
| 1586 | 1586 | // Save the image in the uploads directory. |
| 1587 | 1587 | require_once ABSPATH . '/wp-admin/includes/file.php'; |
| 1588 | 1588 | \WP_Filesystem(); |
| 1589 | 1589 | global $wp_filesystem; |
| 1590 | + if ( ! is_a( $wp_filesystem, 'WP_Filesystem_Base' ) ) { | |
| 1591 | + $creds = request_filesystem_credentials( site_url() ); | |
| 1592 | + wp_filesystem( $creds ); | |
| 1593 | + } | |
| 1590 | 1594 | $upload_file = $wp_filesystem->put_contents( $upload_path . $hashed_filename, $decoded ); |
| 1591 | 1595 | |
| 1592 | 1596 | // Insert new chart image. |
| 1593 | 1597 | $attachment = array( |