Read a plugin file
wp_read_plugin_fileRead a file inside an installed plugin's folder; theme and uploads files have their own readers (wp_read_theme_file, wp_read_upload_file). Returns file, content (the raw file content as a string), bytes, file_size and offset. A file up to 2 MB is read whole; a larger one is refused with its size unless offset/length select a slice of at most 2 MB. A missing file is an error. Raw source access: plugin code may contain hardcoded API keys, credentials or other secrets. Requires edit_plugins; runs only with the site's write access on. Forwarded by AlphaBridge Connect to the one site this connection reaches.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | Path relative to the plugin folder, e.g. "includes/class-foo.php", as wp_list_plugin_files lists it; ".." and symlinked files are refused. | |
| length | No | Number of bytes to read, at most 2 MB per call. Default: up to 2 MB from offset when offset is above 0; otherwise the whole file, which a file over 2 MB is refused for (offset 0 needs a length to read a slice). | |
| offset | No | Byte offset to start reading from. Default 0. | |
| plugin | Yes | Plugin folder name, e.g. "akismet" (the part before the slash in the file wp_list_plugins returns). |