Skip to content

How-to Guides

Technical References

VIP Codebase /

Using the /private directory

The /private folder in your repo, if used, 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' );

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.

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 folder is mapped to /private, in the root of the filesystem, on the VIP Go server.

Last updated: November 24, 2020