Skip to content

Filesystem

Read and scan any file inside the WordPress installation (core, plugins, themes, uploads) and, when you opt in, modify and delete files. Every path is confined to the WordPress installation (ABSPATH); there is no directory traversal and no symlink escape outside the root.

The 3 read tools are enabled by default. The 3 write/delete tools ship disabled-by-default. An admin opts in per-tool on EMCP Tools → Tools in wp-admin. All six require manage_options.

Risk notice. File read can expose any secret stored as a plain file in the tree — the read-protected list below (v3.14.1) covers the common cases, but a site-specific secrets file outside it is still readable unless you add it via the filter. Enabling the write tools is effectively remote code execution. An agent can edit any PHP file WordPress then loads. These tools are confined to ABSPATH, ship disabled-by-default, are admin-gated, auto-back-up every file before writing, and audit-log every mutation. Arbitrary filesystem access is contrary to WordPress.org plugin guidelines; this feature exists per an explicit project decision and stays off unless you enable it.

Return the contents of any file inside ABSPATH. Refuses a read-protected path (a protected_read error) — see below. Read-only (manage_options).

List the entries in a directory inside ABSPATH: names, types, sizes, modified times. Read-only (manage_options).

Search for files matching a name pattern or containing a string within ABSPATH. Silently omits matches inside a read-protected path rather than erroring, same list as read-file. Read-only (manage_options).

read-file/search-files refuse, by basename: wp-config.php, wp-config-local.php (Bedrock and several hosting stacks), .env (Bedrock, Docker, containerized setups), .htpasswd, auth.json (Composer HTTP-basic tokens), .netrc, id_rsa, id_ed25519 — plus two pattern rules: any wp-config.*/wp-config-* variant (catches wp-config.php.bak, .save, .old, editor swap files) and anything inside a .git directory (a remote URL there can carry an embedded token). All paths are resolved to their real, symlinked target before the check runs, so a symlink pointing at a protected file is refused the same as the file itself — and can’t be used to read outside ABSPATH either. Filterable via emcp_tools_fs_read_protected_paths.

Every write/delete tool: confines the path to ABSPATH, auto-backs up the original first, refuses wp-config.php and .htaccess (a broader list than the read tools above, which only refuse wp-config.php — write-side protection is filterable via emcp_tools_fs_protected_paths, a separate filter from the read-side one), requires the edit_files capability (honoring DISALLOW_FILE_EDIT), and records the change to an audit log.

Write (create or overwrite) a file inside ABSPATH (edit_files + manage_options).

Apply a targeted find-and-replace or line-range edit to a file inside ABSPATH (edit_files + manage_options).

Delete a file inside ABSPATH. Requires an explicit confirm:true (edit_files + manage_options).

write-file, edit-file, and delete-file are off until you enable them. Open EMCP Tools → Tools in wp-admin, find the Filesystem category on the WordPress tab, and toggle the ones you want. See Disabling tools.