Vajna Botond

Designer

Create files in wp theme editor

In WP theme editor open functions.php, and add the following code and replace my-file.php with your file name.

add_action('after_setup_theme', function() {
	$file = get_stylesheet_directory() . '/my-file.php';
	if(!file_exists($file)) {
		include_once ABSPATH . 'wp-admin/includes/file.php';
		\WP_Filesystem();
		global $wp_filesystem;
		$wp_filesystem->put_contents($file, '', FS_CHMOD_FILE);
	}
});

source:
https://chap.website/creating-new-files-in-the-wordpress-theme-editor/