Skip to content

Backgrounds

How-to Guides

Technical References

VIP Codebase /

/private directory

The /private directory is mapped to /private, in the root of the filesystem, on the VIP Go server. If used, it will provide access to files that are not web accessible, but can be accessed by your theme or plugins. We provide a constant, WPCOM_VIP_PRIVATE_DIR, which contains the path to the private folder, and you should always use this to access the /private folder.

For example, if you place a file at /private/sites.json you can access that within your theme with:

file_get_contents( WPCOM_VIP_PRIVATE_DIR . '/sites.json' );

No visitor will be able to access that file at any URL, unless deliberately exposed via the theme or a plugin.

Like all code directories on VIP Go, the /private directory is not writable by PHP, so you cannot save uploaded files to it.

The /private directory might be used to store files streamed via PHP, e.g., a paid, commercial plugin which needs a purchase record checked before starting the download.

Caution

This constant is only available inside theme or plugin code; using it in vip-config.php is too early and will not produce the desired behavior.

Last updated: April 09, 2021