Issue on moving website to Local on Windows
-
I engaged ChatGPT to word the following, yeah I hate it but use it. I also tried deleting the plugin folder then reinstalling – same error occurred.
Subject: Bug Report: File Path Issue on Windows / Local with “Shortcode for Current Date” PluginHi [Developer’s Name],
I’m reporting a repeatable issue with the latest version of the “Shortcode for Current Date” plugin when installing on a Windows-based Local environment (using LocalWP).Issue Summary:
When activating the plugin, the following fatal error occurs:
Warning: require(E:\Workshop\...\shortcode-for-current-date/E:\Workshop\...\shortcode-for-current-date\vendor\dotcamp\promoter/inc/Config/config_core.php): Failed to open stream: No such file or directory Fatal error: Uncaught Error: Failed opening required...Observation:
Your plugin’s code is concatenating absolute file paths twice, which is invalid on Windows. The resultingrequire()call includes a broken path like:E:\Workshop\...\plugin-folder/E:\Workshop\...\plugin-folder\vendor\...This is almost certainly happening because paths aren’t being normalized properly between Windows
\and URLs/.Environment Details:- Windows 11
- LocalWP (NGINX / MySQL / PHP 8.x)
- WordPress latest version
- Plugin: shortcode-for-current-date latest from WP repo
Suggested Solution:
Instead of concatenating absolute paths manually, you should use:
require_once plugin_dir_path( __FILE__ ) . 'vendor/dotcamp/promoter/inc/Config/config_core.php';or
require_once trailingslashit( __DIR__ ) . 'vendor/dotcamp/promoter/inc/Config/config_core.php';This approach safely resolves paths on both Linux and Windows.Why This Matters:
- Works fine on Linux servers (most production environments)
- Breaks immediately on LocalWP or Windows servers
- Hard to debug for novice users because it looks like a missing file when it’s really a path error
Thank you for your work on the plugin — I’m happy to help test a patched version if needed.
Kind regards,
[Your Name]
The topic ‘Issue on moving website to Local on Windows’ is closed to new replies.