Documentation

DooFiles

Filters and constants

For developers: the filters that change what DooFiles shows and how much it keeps, the constants of wp-config.php it respects, and the capability that decides who can open it, with examples.

Last updated: Oct 24, 2026

Overview

DooFiles can be set from the code of your site, for example to keep the same settings on every site you manage, to show only part of the server, or to lock DooFiles in read-only mode on your live site. This page lists:

  • the filters that change what DooFiles shows and how much it keeps;
  • the constants of wp-config.php that DooFiles respects;
  • the capability that decides who can open DooFiles.

Most filters replace a setting of DooFiles › Settings. Site owners can change those settings without code. See Settings.

Where to add the code

Add your filters in a must-use plugin, so they keep working when you change your theme and load before DooFiles:

  1. Create the folder wp-content/mu-plugins if it does not exist.
  2. Create a file inside it, for example doofiles-config.php, that starts with <?php.
  3. Add your filters below that line.
php
<?php
// Keep the activity log for 180 days.
add_filter( 'doofiles_log_days', function () {
    return 180;
} );

WordPress loads every file of that folder on its own. The functions.php file of your theme also works, but it stops working if you change your theme.

Filters and the settings page

A filter wins over the setting it replaces. As soon as you hook one, the matching row of DooFiles › Settings shows as locked, with the note Set by the … filter in the site's code., even if your filter returns the same value. To give the row back to the settings page, remove the filter.

Sizes go in bytes. Use the constants of WordPress to write them: 5 * MB_IN_BYTES, GB_IN_BYTES.

Where DooFiles works

FilterValueDefaultSettings row
doofiles_rootThe full path of the folder that DooFiles opens as its top folderThe folder of WordPress—

DooFiles can only open folders inside the folder of WordPress. With this filter you can narrow that down to one of its folders, for example wp-content:

php
add_filter( 'doofiles_root', function () {
    return WP_CONTENT_DIR;
} );

If the folder does not exist, or is outside the folder of WordPress, DooFiles ignores the filter and opens the whole folder of WordPress.

Private folders cannot be inside the folders of WordPress, such as wp-content. With one of those as the top folder, you cannot create private folders.

Security

FilterValueDefaultSettings row
doofiles_read_onlytrue to turn on read-only modefalseRead-only mode
doofiles_require_reauthtrue or false: ask for the password before changing codeThe setting (true)Ask for the password before changing code
doofiles_reauth_ttlSeconds that the password confirmation lasts. At least 60The setting (10 minutes)Minutes the confirmation lasts

doofiles_read_only can only turn read-only mode on. When the settings page or a constant of wp-config.php turns it on, returning false does not turn it off.

For example, to keep DooFiles in read-only mode on your live site and let it change files on your staging and local copies:

php
add_filter( 'doofiles_read_only', function () {
    return 'production' === wp_get_environment_type();
} );

WordPress treats a site as production unless WP_ENVIRONMENT_TYPE in wp-config.php says otherwise, so set it to staging or local on your other copies.

With doofiles_require_reauth set to false, saving the settings of the site, managing private folders and managing the second factor still ask for the password. See Password confirmation.

To make the confirmation last 30 minutes:

php
add_filter( 'doofiles_reauth_ttl', function () {
    return 30 * MINUTE_IN_SECONDS;
} );

Sizes and limits

FilterValueDefaultSettings row
doofiles_max_edit_sizeLargest file the editor opens, in bytesThe setting (2 MB)Largest file the editor opens
doofiles_max_upload_sizeLargest upload, in bytes. At least 1 MBThe setting (2 GB)Largest upload
doofiles_backup_max_sizeLargest file that is backed up when it is saved or replaced, in bytes50 MB—
doofiles_unzip_max_entriesMost files and folders in a zip archive that DooFiles extracts20,000—
doofiles_unzip_max_sizeMost space the extracted files of one archive can take, in bytes1 GB—

For example, to let the editor open files up to 5 MB and allow uploads up to 500 MB:

php
add_filter( 'doofiles_max_edit_size', function () {
    return 5 * MB_IN_BYTES;
} );

add_filter( 'doofiles_max_upload_size', function () {
    return 500 * MB_IN_BYTES;
} );

Very large files make the editor slow, because the browser has to load and highlight all their text. See Editor and uploads, Backups and Manage files.

Trash, backups and activity

FilterValueDefaultSettings row
doofiles_trash_daysDays that deleted items stay in the TrashThe setting (30)Days in the trash
doofiles_backup_daysDays that backups are keptThe setting (30)Days to keep backups
doofiles_backup_keepBackups kept for each file. At least 1The setting (10)Backups per file
doofiles_log_daysDays that entries of the activity log are keptThe setting (90)Days of activity
doofiles_log_maxMost entries the activity log keepsThe setting (50,000)Most activity entries

For the days, 0 keeps the items forever. For doofiles_log_max, 0 keeps every entry. Keep in mind that the Trash, the backups and the log then grow without end.

For example, to empty the Trash after 7 days:

php
add_filter( 'doofiles_trash_days', function () {
    return 7;
} );

DooFiles deletes old items once a day, and the extra backups of a file each time it gets a new one. See Trash, backups and activity.

Constants

Add these lines to wp-config.php, above the line that says That's all, stop editing!

ConstantWhat it doesSee
DISALLOW_FILE_EDITA constant of WordPress. DooFiles works in read-only modeRead-only mode
DISALLOW_FILE_MODSA constant of WordPress. DooFiles works in read-only modeRead-only mode
DOOFILES_DISABLE_2FATurns off the second factor of DooFiles for everyone. Only for emergencies, such as a lost phone without recovery codesSecond factor
php
define( 'DOOFILES_DISABLE_2FA', true );

Remove DOOFILES_DISABLE_2FA as soon as you have access again.

Who can open DooFiles

DooFiles has its own capability, doofiles_manage. When you activate DooFiles, it gives that capability to the Administrator role.

To open DooFiles, a user needs both doofiles_manage and the capability to manage the options of the site (manage_options). Giving doofiles_manage to an editor does not let them in. On a multisite network, network administrators can always open DooFiles.

Keep one administrator out

To keep one administrator out of DooFiles without changing their role, deny them the capability. Run this once, with WP-CLI:

bash
wp eval "get_user_by( 'login', 'jane' )->add_cap( 'doofiles_manage', false );"

Replace jane with their username. DooFiles disappears from their menu, and they cannot open its private folders. To give it back:

bash
wp eval "get_user_by( 'login', 'jane' )->remove_cap( 'doofiles_manage' );"

A role editor plugin that can deny capabilities to a user works too.

Check whether DooFiles is active

DooFiles defines DOOFILES_VERSION with its version, for example 1.0.4. Use it to run code only when DooFiles is active:

php
if ( defined( 'DOOFILES_VERSION' ) && version_compare( DOOFILES_VERSION, '1.0.4', '>=' ) ) {
    // DooFiles 1.0.4 or newer is active.
}

DooFiles has no actions or JavaScript hooks of its own yet. If you need one, open a support ticket and tell us what for.

Troubleshooting

ProblemWhat to do
My filter does nothingCheck that the file is in wp-content/mu-plugins, not in a subfolder, and starts with <?php. The matching row of the settings page shows as locked when the filter works
A row of the settings page is locked and I did not add a filterAnother plugin or your theme hooks that filter. The note under the row says which one
doofiles_root does nothingThe folder does not exist, or is outside the folder of WordPress. Use a full path, such as WP_CONTENT_DIR
Read-only mode does not turn off with doofiles_read_onlyThe filter can only turn it on. Check the settings page and wp-config.php
An administrator cannot open DooFilesTheir role or their user lacks the doofiles_manage capability. If you denied it with add_cap, give it back with remove_cap, as shown above. Deactivating and activating DooFiles gives it back to the Administrator role

Need more help? Open a support ticket.