Read a theme file
read_theme_fileRetrieve the current content of any WordPress theme file before editing to ensure accurate changes, since write replaces the entire file and edit requires exact text match.
Instructions
Read the contents of one theme file. Always read before editing — write_theme_file replaces the whole file, and edit_theme_file needs exact text to match.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path relative to the theme root, e.g. "functions.php" or "template-parts/hero.php". | |
| theme | No | Theme stylesheet or draft id. Defaults to the active theme. | |
| site_id | No | Which configured WordPress site to act on. Optional — with a single site configured it is used automatically; with several, the default site is used unless you name one. Run list_sites for valid ids. | |
| max_chars | No | Truncate very large files at this many characters. |