| @@ -208,10 +208,10 @@ | ||
| 208 | 208 | WP_Filesystem( false, $upload_dir_url['basedir'], true ); |
| 209 | 209 | if ( ! $wp_filesystem->is_dir( $dir ) ) { |
| 210 | 210 | $wp_filesystem->mkdir( $dir ); |
| 211 | 211 | } |
| 212 | - if ( ! file_exists( $dir . $type . '.json' ) ) { | |
| 213 | - fopen( $dir . $type. '.json', "w" ); //phpcs:ignore | |
| 212 | + if ( ! $wp_filesystem->exists( $dir . $type . '.json' ) ) { | |
| 213 | + $wp_filesystem->put_contents( $dir . $type . '.json', '' ); | |
| 214 | 214 | } |
| 215 | 215 | return $dir; |
| 216 | 216 | } catch ( \Exception $e ) { |
| 217 | 217 | return array( |