What the failed to open stream error means
WordPress, themes and plugins use PHP functions such as require(), require_once() and include() to load other PHP files. A failed to open stream warning appears when PHP follows one of those instructions but the target file is missing, inaccessible or referenced using the wrong path.
Read the complete error rather than only the first line. It will often contain the file that made the request, its line number and the path PHP attempted to open. A path containing wp-content/plugins/ usually points towards a plugin problem, while a path under wp-content/themes/ suggests the active theme or a child theme.
A warning from require() may be followed by a fatal error because PHP cannot continue when a required file is unavailable. That can leave the front end, WordPress admin area or both inaccessible.
Common causes on WordPress sites
A failed plugin or theme update is a frequent cause. Part of the package may have been replaced while another required file was not copied correctly. The same problem can occur after manually moving a site, restoring an incomplete backup or uploading only part of a plugin directory.
Custom PHP can also contain an incorrect relative path. A statement such as require 'includes/file.php'; depends on the execution context, so code can work in one location and fail after files are moved. Developers commonly build predictable paths from __DIR__ instead.
Other causes include a renamed file, incorrect filename capitalisation on Linux hosting, a plugin expecting a dependency that is no longer installed, or filesystem ownership and permissions preventing PHP from reaching a file that does exist. Security software can occasionally quarantine a compromised PHP file, exposing a separate underlying security problem.
How to fix failed to open stream safely
- Take a full backup of the website files and database before editing, replacing or restoring anything.
- Copy the full error and identify the missing path. Check whether it points to WordPress core, a plugin, a theme or custom code.
- If the path belongs to a plugin or theme and the error started after an update, reinstall a clean current copy from its original source. Do not replace individual WordPress core files unless you know exactly why they are missing.
- If you cannot reach WordPress because a plugin is failing, use your hosting file manager or SFTP to rename only that plugin's directory inside wp-content/plugins. WordPress will treat the plugin as unavailable. Restore the original directory name before reinstalling or troubleshooting it further.
- For custom code, check the path against the real directory structure. A developer may use an absolute path based on the current file, for example:
Do not make this change blindly inside third party plugins because an update may overwrite it and the missing file may indicate a damaged installation instead.require __DIR__ . '/includes/example.php'; - If the file exists, check ownership and permissions with your host. WordPress documents typical file permissions of 644 and directory permissions of 755 for many configurations, but the correct values depend on the server. Do not set directories to 777 as a routine workaround.
If the source is still unclear, WordPress debugging can log the call stack. On a staging copy, or briefly during controlled diagnosis, WP_DEBUG and WP_DEBUG_LOG can be configured in wp-config.php. Avoid displaying detailed PHP errors publicly on a live site.
When to stop troubleshooting and get help
Stop making changes if the missing path belongs to unfamiliar custom code, several files have disappeared, permissions appear to change by themselves, or restoring the expected file immediately produces another failure. Those symptoms need diagnosis rather than repeated file replacement.
If files have vanished without an update or deployment explaining it, consider the possibility of malware or a damaged hosting account and investigate before restoring files into the same environment. Our website security guidance explains the wider checks worth making.
Web Support Services offers an Emergency Fix for £249 per incident with a response within 2 working hours. For ongoing maintenance, care plans start from £59 a month.