WordPress Failed to Open Stream No Such File or Directory
What Is This Error?
This error is thrown by PHP when WordPress tries to load a file that simply isn’t where it expects it to be. The full message usually looks something like: Warning: require(/home/user/public_html/wp-content/plugins/some-plugin/file.php): failed to open stream: No such file or directory. PHP is telling you — loudly — that it went looking for that file and came up empty.
You’ll most often see this as a white screen, a partial page with a PHP warning at the top, or a complete site crash depending on which file is missing. If the missing file is part of a plugin, you might only lose that feature. If it’s a theme file or a WordPress core file, your entire front end could go down.
The good news is this error always tells you exactly which file is missing and the full path to where PHP expected to find it. That path is your starting point for the fix.
Get free WordPress & AI tips
Join 500+ readers. No spam, unsubscribe anytime.
Why Does This Happen?
- Incomplete plugin or theme upload: If a plugin or theme was partially uploaded via FTP or the WordPress dashboard, some files may be missing from the server entirely.
- A plugin or theme was deleted manually: Removing plugin files directly from the server without deactivating them through WordPress leaves behind references that still try to load the deleted files.
- A failed or interrupted update: When a plugin, theme, or WordPress core update gets cut off mid-way due to a server timeout or dropped connection, the file structure can be left in a broken state.
- Hardcoded file paths in custom code: If a developer hardcoded an absolute file path in a custom plugin or theme and the site was later migrated to a new server or directory, that path no longer matches reality.
- Accidental file deletion via File Manager or FTP: It’s easy to accidentally delete a file while cleaning up your server — and WordPress will complain the next time it tries to load that file.
How to Fix It — Step by Step
-
Read the error message carefully. The error tells you the exact file path PHP was looking for. Note the plugin or theme name embedded in that path — it tells you precisely where the problem originates.
You should see: A path like
/wp-content/plugins/plugin-name/some-file.phpclearly identifying the broken component. -
Connect to your server via FTP or your host’s File Manager and navigate to the directory mentioned in the error. Check whether that file actually exists there.
You should see: Either the file is missing entirely or it exists but may have a permission issue.
-
If the file belongs to a plugin: Go to your WordPress dashboard → Plugins → Deactivate the plugin, then delete it and reinstall it fresh from the WordPress repository. If you have WP-CLI available:
wp plugin deactivate plugin-name wp plugin delete plugin-name wp plugin install plugin-name --activateYou should see: The plugin reinstalled and active with no PHP errors on the page.
-
If the file belongs to a theme: Switch to a default WordPress theme from Appearance → Themes, then delete and reinstall your original theme. If it’s a premium theme, re-download the full package from the provider and re-upload it.
You should see: Your theme loading correctly with no stream errors.
-
If the error points to a WordPress core file (anything inside
/wp-includes/or/wp-admin/), reinstall WordPress core. Go to Dashboard → Updates → Re-install Now, or use WP-CLI:wp core download --forceYou should see: Core files refreshed with your plugins, themes, and content completely untouched.
-
If the error is in custom code with a hardcoded path, replace the absolute path with a dynamic WordPress function so it resolves correctly regardless of server location:
// Replace this: require_once '/home/user/public_html/wp-content/plugins/my-plugin/file.php'; // With this: require_once plugin_dir_path( __FILE__ ) . 'file.php';You should see: No more path errors, even if the site moves to a different server or directory in the future.
Common Mistakes When Fixing This
- Ignoring the file path in the error message: The path is a direct map to the broken file — skipping it means guessing blindly. Always read the full error first and identify whether it points to a plugin, theme, or core file before touching anything.
- Running chmod commands when the file doesn’t exist: Changing file permissions does nothing if the file isn’t physically there. Permissions only matter when the file exists but WordPress can’t read it. Confirm the file is present before adjusting permissions.
- Only deactivating the plugin without reinstalling it: Deactivating stops the plugin’s own hooks from running, but if another plugin or theme is calling the missing file directly, the error will keep showing. Delete and reinstall the plugin cleanly instead.
- Suppressing the error with WP_DEBUG false instead of fixing the cause: Turning off debug mode makes the error invisible, but the file is still missing. The site will continue to malfunction silently. Fix the root cause — don’t just hide the symptom.
Frequently Asked Questions
Will this error always crash my entire site?
Not necessarily. If the missing file belongs to a non-critical plugin, only that plugin’s functionality breaks. But if the file is part of your active theme or WordPress core, you’ll likely see a white screen or a fully broken front end until the issue is resolved.
Can I fix this without FTP access?
Yes — if your WordPress dashboard is still accessible, use the built-in plugin and theme reinstaller directly from the admin panel. Your hosting control panel’s File Manager is a solid FTP alternative. If both are inaccessible, contact your host’s support team to restore the missing file from a recent backup.
What if the error keeps returning after I reinstall the plugin?
Something else on your site is likely calling that file directly. Check your active theme’s functions.php and any custom plugins for require or include statements that reference the same file path. Remove or update those references to stop the error from reappearing.
How do I see the full error if my site is just showing a white screen?
Add these two lines to wp-config.php temporarily: define('WP_DEBUG', true); and define('WP_DEBUG_LOG', true);. The full error including the missing file path will either display on screen or be written to /wp-content/debug.log. Remove both lines once you’ve identified and resolved the issue.
