Appearance
Developers Guide
This section contains technical documentation for developers who want to extend or integrate with Virtual Files plugin.
Technical Architecture
Virtual Files is built with modern WordPress development best practices:
- MVC Architecture: Clean separation between controllers and views
- PSR-4 Autoloading: Modern PHP autoloading via Composer
- Trait-Based Design: Modular functionality using PHP traits
- Security-First Approach: Nonce verification, input sanitization
- Performance Optimized: Transient caching for Pro users
Plugin Constants
| Constant | Value | Description |
|---|---|---|
INTENTDEEP_VF_PLUGIN_ROOT | /path/to/plugins/intentdeep-virtual-files-freemius/ | Plugin root directory path |
Post Type & Meta Keys
Custom Post Type
Post Type Name: idep_virtual_file
Post Status:
publish= Active (file is publicly accessible)draft= Inactive (file returns 404)
Available Meta Keys
| Meta Key | Type | Description | Example |
|---|---|---|---|
_vf_filename | String | Full filename with path and extension | robots.txt, .well-known/security.txt |
_vf_content | Long Text | File content | User-agent: *\nDisallow: / |
_vf_mime_type | String | MIME type for HTTP headers | text/plain, application/json |
_vf_status | String | File status | active, inactive |
_vf_modified | Timestamp | Last modified time | 2026-01-01 12:00:00 |
_vf_access_count | Integer (Pro) | Total access count | 42 |
_vf_analytics_daily | Array (Pro) | Daily view statistics | {"2026-01-01": 10, "2026-01-02": 15} |
Hooks & Filters
intentdeep_vf_allowed_extensions
Modify the list of allowed file extensions.
Parameters:
$extensions(array) - Array of allowed file extensions
Usage Example:
php
add_filter('intentdeep_vf_allowed_extensions', function($extensions) {
// Add custom extension to allowed list
$extensions[] = 'custom';
return $extensions;
});Default Extensions:
- Free users:
txt,md,json - Pro users:
txt,md,json,jsonld,xml,rss,csv,yml,log
Programmatic File Creation
Create virtual files programmatically using WordPress functions:
php
// Create a virtual file programmatically
$file_id = wp_insert_post([
'post_type' => 'idep_virtual_file',
'post_title' => 'My Virtual File',
'post_status' => 'publish' // 'publish' = Active, 'draft' = Inactive
]);
// Add file metadata
if ($file_id) {
// 1. Set the full filename (extension is required)
update_post_meta($file_id, '_vf_filename', 'robots.txt');
// 2. Set MIME type (optional, but recommended)
update_post_meta($file_id, '_vf_mime_type', 'text/plain');
// 3. Set the content
update_post_meta($file_id, '_vf_content', "User-agent: *\nDisallow: /wp-admin/\n");
// 4. Set status to active
update_post_meta($file_id, '_vf_status', 'active');
}Example with Nested Path
php
// Create a file in nested directory
$file_id = wp_insert_post([
'post_type' => 'idep_virtual_file',
'post_title' => 'Security TXT',
'post_status' => 'publish'
]);
if ($file_id) {
update_post_meta($file_id, '_vf_filename', '.well-known/security.txt');
update_post_meta($file_id, '_vf_mime_type', 'text/plain');
update_post_meta($file_id, '_vf_content', 'Contact: security@example.com');
update_post_meta($file_id, '_vf_status', 'active');
// Flush rewrite rules to make file accessible
flush_rewrite_rules();
}Querying Virtual Files
php
// Get all active virtual files
$files = get_posts([
'post_type' => 'idep_virtual_file',
'post_status' => 'publish',
'numberposts' => -1,
'orderby' => 'modified',
'order' => 'DESC'
]);
// Get file metadata
foreach ($files as $file) {
$filename = get_post_meta($file->ID, '_vf_filename', true);
$content = get_post_meta($file->ID, '_vf_content', true);
$mime_type = get_post_meta($file->ID, '_vf_mime_type', true);
}Need More Developer Tools?
The Virtual Files plugin is actively being developed. More hooks, filters, and developer tools may be added in future versions based on community feedback and developer needs.
Suggest a Hook or Filter: If you need a specific hook or filter that isn't currently available, please:
- Open an issue on the GitHub repository
- Or contact the development team through the support page
We'll consider adding it in a future update if there's sufficient community demand.
Last Updated: January 11, 2026 Plugin Version: 1.0.0