Skip to content

File Types

Virtual Files supports multiple file types with specific MIME type mappings and Free/Pro tier differences. This guide covers all supported file types and their applications.

Supported File Types Overview

File TypeExtensionsMIME TypeFree VersionPro VersionCommon Uses
Text Files.txttext/plain; charset=utf-8Documentation, logs, simple data
Markdown.mdtext/markdown; charset=utf-8Documentation, readme files
JSON.jsonapplication/json; charset=utf-8API responses, configuration
XML.xmlapplication/xml; charset=utf-8Sitemaps, RSS feeds, data exchange
RSS.rssapplication/rss+xml; charset=utf-8News feeds, updates
CSV.csvtext/csv; charset=utf-8Data export, spreadsheets
YAML.yml, .yamltext/yaml; charset=utf-8Configuration files
Log Files.logtext/plain; charset=utf-8Debug logs, access logs

Free Version File Types

Text Files (.txt)

Features

  • Basic text content serving with proper UTF-8 charset headers
  • Simple monospace textarea editor
  • 1MB maximum content size

Common Use Cases

robots.txt
text
User-agent: *
Allow: /
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/plugins/
Disallow: /wp-content/themes/

Sitemap: https://yourdomain.com/sitemap.xml
Configuration Files
text
# Application Configuration
app_name=My WordPress Site
version=1.0.0
debug=false
api_key=your_api_key_here

Markdown Files (.md)

Features

  • Basic textarea editing with monospace font
  • No syntax highlighting (Free version)
  • Standard markdown support

Common Use Cases

README Documentation
markdown
# My WordPress Plugin

A comprehensive WordPress plugin for managing virtual files.

## Features

- Virtual file management
- Multiple file types support
- Performance optimization

## Installation

1. Download plugin
2. Upload to wp-content/plugins
3. Activate in WordPress admin

JSON Files (.json)

Features

  • Basic JSON content serving
  • Simple textarea editor (no syntax highlighting in Free)
  • Proper JSON MIME headers

Common Use Cases

API Configuration
json
{
  "api_version": "1.0",
  "site_name": "My WordPress Site",
  "endpoints": {
    "posts": "/api/posts.json",
    "pages": "/api/pages.json"
  },
  "authentication": {
    "type": "bearer_token",
    "required": true
  }
}

Pro Version File Types

XML Files (.xml)

Features

  • CodeMirror editor with XML syntax highlighting (Pro)
  • Auto-validation and error detection (Pro)
  • Proper XML MIME headers
  • UTF-8 encoding support

Common Use Cases

Sitemap
xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>https://yourdomain.com/</loc>
        <lastmod>2026-01-01T12:00:00+00:00</lastmod>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
    </url>
</urlset>
RSS Feed
xml
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
    <channel>
        <title>My WordPress Site</title>
        <description>Latest news and updates</description>
        <link>https://yourdomain.com</link>
        <item>
            <title>Sample Post</title>
            <link>https://yourdomain.com/sample-post</link>
            <description>Post description here</description>
        </item>
    </channel>
</rss>

RSS Files (.rss)

Features

  • Dedicated RSS feed format with proper MIME type
  • CodeMirror syntax highlighting (Pro)
  • Auto-validation of RSS structure (Pro)

Common Use Cases

News Feed
xml
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
    <channel>
        <title>Site News</title>
        <description>Latest updates from our site</description>
        <link>https://yourdomain.com</link>
        <item>
            <title>New Feature Released</title>
            <description>We've just released a new feature!</description>
            <pubDate>Mon, 01 Jan 2026 12:00:00 +0000</pubDate>
        </item>
    </channel>
</rss>

CSV Files (.csv)

Features

  • Proper CSV MIME type serving
  • Comma-separated format support
  • CodeMirror editing with CSV syntax highlighting (Pro)

Common Use Cases

Product Export
csv
id,title,price,category,stock,sku
1,"WordPress Theme",49.99,"Themes",15,"WP-THEME-001"
2,"Plugin Bundle",29.99,"Plugins",50,"WP-BUNDLE-001"
3,"Support Package",99.99,"Services",100,"WP-SUPPORT-001"

YAML Files (.yml/.yaml)

Features

  • Support for both .yml and .yaml extensions
  • Text/yaml MIME type serving
  • CodeMirror syntax highlighting (Pro)
  • Structure validation (Pro)

Common Use Cases

Docker Configuration
yaml
version: '3.8'

services:
  wordpress:
    image: wordpress:6.0
    ports:
      - "8080:80"
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: secure_password
GitHub Actions Workflow
yaml
name: WordPress Build

on:
  push:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run Tests
        run: npm test

Log Files (.log)

Features

  • Text/plain MIME type serving
  • CodeMirror editing with log syntax highlighting (Pro)
  • Common log format support
  • Timestamp and level detection (Pro)

Common Use Cases

Access Log
text
[2026-01-01 12:00:00] INFO GET /robots.txt 0.045s 200
[2026-01-01 12:00:15] INFO GET /sitemap.xml 0.038s 200
[2026-01-01 12:01:30] WARNING GET /admin/ 0.089s 403
Error Log
text
[2026-01-01 12:00:00] ERROR Database connection failed
[2026-01-01 12:00:15] WARNING Cache write timeout
[2026-01-01 12:01:30] INFO Rewrite rules flushed successfully

File Type Configuration

MIME Type Mappings

Each file extension is automatically mapped to its appropriate MIME type:

php
$mime_types = [
    'txt'  => 'text/plain; charset=utf-8',
    'md'   => 'text/markdown; charset=utf-8',
    'json' => 'application/json; charset=utf-8',
    'xml'  => 'application/xml; charset=utf-8',
    'rss'  => 'application/rss+xml; charset=utf-8',
    'csv'  => 'text/csv; charset=utf-8',
    'yml'  => 'text/yaml; charset=utf-8',
    'yaml' => 'text/yaml; charset=utf-8',
    'log'  => 'text/plain; charset=utf-8',
];

File Type Selection

When creating or editing files:

  1. Dropdown Interface: Select from available file types
  2. Pro Feature Indicators: Pro-only types show upgrade prompts
  3. MIME Auto-Detection: Content-Type header set automatically
  4. Validation: File extension must be from allowed list

Extension Filtering

  • Free Users: Only .txt, .md, .json available in dropdown
  • Pro Users: All extensions available
  • Custom Extensions: Can be filtered via virtual_files_allowed_extensions hook
  • Security: Only predefined extensions allowed for security

Editor Support Differences

Free Version Editor

  • Basic WordPress textarea with monospace font
  • No syntax highlighting
  • Simple text editing capabilities
  • 1MB content size limit

Pro Version Editor (CodeMirror)

  • Syntax Highlighting: For all supported file types
  • Theme Options: Light (default) and Dark (monokai) themes
  • Line Numbers: Show/hide line numbers
  • Bracket Matching: Visual matching of opening/closing brackets
  • Search Functionality: Find and replace in editor
  • Keyboard Shortcuts:
    • Ctrl-Space: Auto-complete
    • Ctrl-/: Toggle comment
    • F11: Fullscreen mode
  • Auto-indent: Smart indentation based on file type
  • Multiple Cursor: Multiple text cursors for bulk editing

File Validation

Filename Validation

  • Character Restrictions: No <>:"|?* characters
  • Length Limit: Maximum 255 characters
  • Uniqueness Check: No duplicate filenames allowed
  • Extension Validation: Must match selected file type

Content Validation

  • Required Field: Content cannot be empty
  • Size Limits: 1MB maximum content size
  • Security Scanning: Automatic sanitization of dangerous content
  • Encoding Support: UTF-8 character handling

File Type Validation

  • Extension Match: Content must match file type (basic validation)
  • MIME Verification: Correct MIME headers sent
  • Structure Validation: Basic syntax checking (Pro feature)
  • Error Detection: Highlight common errors in editor (Pro)

Performance Considerations

File Serving

  • Direct Serve: Files served via WordPress routing
  • MIME Headers: Proper Content-Type headers set
  • Charset Support: UTF-8 encoding for all text types
  • Caching: Cache support for all file types (Pro feature)

Content Size

  • Memory Management: Efficient serving of large content
  • Compression: Gzip compression when available
  • Stream Processing: Large files streamed to prevent memory issues
  • Browser Caching: Appropriate cache headers sent

Best Practices

File Type Selection

  • Choose appropriate file type for your content
  • Use JSON for structured data
  • Use XML for sitemaps and feeds
  • Use TXT for simple configuration
  • Use Markdown for documentation

Content Optimization

  • Keep file sizes reasonable for performance
  • Use proper formatting for chosen file type
  • Validate syntax before publishing
  • Test files in different browsers

Security Considerations

  • Don't include sensitive information in accessible files
  • Use proper file permissions
  • Validate input when generating dynamic content
  • Regularly review file access

Pro Feature Utilization

  • Use syntax highlighting for easier editing
  • Enable caching for better performance
  • Use advanced file types for complex data
  • Leverage import/export for backups

Next Steps

Now that you understand file types:

  1. Create Files: Start creating virtual files
  2. Configure Settings: Set up allowed file types
  3. Managing Files: Organize your files effectively
  4. Explore Pro Features: Unlock advanced file types

Need Help?

Virtual Files - Better WordPress SEO Through Smart Virtual File Management