Skip to content

Quick Start Guide

Get up and running with Virtual Files in just a few minutes! This guide will walk you through creating your first virtual file.

Step 1: Create Your First Virtual File

  1. Log in to your WordPress admin dashboard
  2. In the left menu, click Virtual Files
  3. Click Add New (or visit wp-admin/edit.php?post_type=virtual_file)

Configure Your Virtual File

Basic Information

  1. Title: Enter a descriptive title (e.g., "Robots File")
  2. Filename: Enter the actual filename (e.g., robots.txt)
  3. File Type: Select the appropriate extension from dropdown

File Content

  1. Content Editor: Add your file content
  2. Preview: See how your file will look when served
  3. Status: Set to "Active" to enable the file

Example: Creating robots.txt

text
User-agent: *
Allow: /
Disallow: /wp-admin/
Disallow: /wp-includes/
Sitemap: https://yourdomain.com/sitemap.xml

Step 2: Publish and Test

Publish Your File

  1. Click Publish in the right sidebar
  2. Confirm publication in the modal
  3. Your virtual file is now live!

Test Your Virtual File

Visit your new virtual file in the browser:

https://yourdomain.com/robots.txt

You should see the content you entered, served as a proper text file with correct headers.

Step 3: Create More Files

Example: JSON Configuration File

  1. Create New File: Click Add New again

  2. Set Details:

    • Title: "API Configuration"
    • Filename: api-config.json
    • File Type: JSON
  3. Add JSON Content:

json
{
  "api_version": "1.0",
  "site_name": "My WordPress Site",
  "endpoints": {
    "posts": "/api/posts.json",
    "pages": "/api/pages.json",
    "media": "/api/media.json"
  },
  "settings": {
    "cache_timeout": 3600,
    "enable_cors": true
  }
}
  1. Publish and test at yourdomain.com/api-config.json

Example: Markdown Documentation

  1. Create Documentation File:

    • Title: "API Documentation"
    • Filename: api-docs.md
    • File Type: Markdown
  2. Add Markdown Content:

markdown
# API Documentation

## Overview
This API provides access to site content in JSON format.

## Endpoints

### Posts
**URL**: `/api/posts.json`
**Method**: GET
**Returns**: Array of post objects

### Pages
**URL**: `/api/pages.json`
**Method**: GET
**Returns**: Array of page objects

## Usage Example

```javascript
fetch('/api/posts.json')
  .then(response => response.json())
  .then(posts => console.log(posts));

License

© 2026 Your Website Name. All rights reserved.


## Step 4: Manage Your Files

### View All Virtual Files
1. Navigate to **Virtual Files** in admin
2. See all your virtual files in a table view
3. Each file shows:
   - Filename and extension
   - File size
   - Last modified date
   - Status (Active/Inactive)

### Edit Existing Files
1. Click on any file title in the list
2. Make changes to content or settings
3. Click **Update** to save changes

### Quick Actions
Hover over any file in the list to see:
- **Edit**: Modify file content
- **Quick Edit**: Change basic settings
- **Trash**: Delete the file
- **View**: Visit the file URL

## Step 5: Configure Settings

### Access Settings
1. Navigate to **Virtual Files → Settings**
2. Configure key options:

#### **Basic Settings**
- **Enable Virtual Files**: Keep this checked for functionality
- **Allowed Extensions**: Choose which file types to enable

#### **File Type Settings**
For each file type, you can:
- Enable/disable specific extensions
- Set default MIME types
- Configure access rules

### Pro Features (If Available)
- **Performance Caching**: Enable for faster file serving
- **Analytics**: Track file access and performance
- **Import/Export**: Backup and restore virtual files

## Common Use Cases

### **SEO Files**
```text
# robots.txt
User-agent: Googlebot
Allow: /
Crawl-delay: 1

User-agent: *
Disallow: /wp-admin/
Sitemap: https://yourdomain.com/sitemap.xml

API Endpoints

json
// posts.json
{
  "status": "success",
  "data": [
    {
      "id": 1,
      "title": "Sample Post",
      "url": "https://yourdomain.com/sample-post"
    }
  ]
}

Configuration Files

xml
<!-- web.config for IIS -->
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Virtual Files" stopProcessing="true">
          <match url="^(robots\.txt|sitemap\.xml)$" />
          <action type="Rewrite" url="index.php?virtual_file=1&file_id={R:1}" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

Tips and Best Practices

File Naming

  • Use descriptive, lowercase filenames
  • Avoid special characters and spaces
  • Use hyphens instead of underscores
  • Keep filenames under 255 characters

Content Optimization

  • Keep file sizes reasonable for performance
  • Use appropriate MIME types
  • Validate JSON/XML syntax
  • Compress large text files when possible

Security Considerations

  • Don't include sensitive information
  • Validate user input in dynamic content
  • Use HTTPS for sensitive endpoints
  • Regularly review file access logs

Performance Tips

  • Enable caching for frequently accessed files
  • Use appropriate file formats
  • Monitor file access patterns
  • Consider CDN integration for high traffic

Next Steps

Now that you've created your first virtual files:

  1. Explore Features: Learn about advanced features
  2. Configure Settings: Fine-tune your plugin settings
  3. Learn File Types: Understand supported file types
  4. Enable Pro Features: Upgrade for advanced functionality

Need Help?

Congratulations! You've successfully created and deployed virtual files on your WordPress site. 🎉

Virtual Files - Better WordPress SEO Through Smart Virtual File Management