Creating directory and file using native wordpress file system
I am creating directory and a css file using conventional php method. Here it is $upload_dir = wp_upload_dir(); $dirpath = $upload_dir[‘basedir’] . ‘/dynamic/’; $filepath = $dirpath. ‘dynamic.css’; if( !file_exists($filepath) ){ mkdir($dirpath); $fh = fopen($filepath, “w”); fclose($fh); } But I want to use native wp filesystem .I have tried if(!$wp_filesystem->is_dir( $dirpath) { $wp_filesystem->mkdir( $dirpath); } Now … Read more