Title: Edge-case bug with require/include and WP-CLI
Last modified: November 2, 2023

---

# Edge-case bug with require/include and WP-CLI

 *  Resolved [cjhaas](https://wordpress.org/support/users/chrisvendiadvertisingcom/)
 * (@chrisvendiadvertisingcom)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/edge-case-bug-with-require-include-and-wp-cli/)
 * In the `Wow_Plugin` class, in the `_includes` method, there’s three includes:
 *     ```wp-block-code
       if ( ! class_exists( 'Wow_Company' ) ) {
           include_once 'includes/class-wow-company.php';
       }
       include_once 'admin/class-admin.php';
       include_once 'public/class-public.php';
       ```
   
 * Unless the include uses path semantics such as `./`, `.//` or `/` (depending 
   on OS), PHP actually searches the local directory _last_, which is probably not
   what you mean.
 * We’ve run into an issue with your plugin because our theme happens to have a 
   file at exactly `admin/class-admin.php`, same as you, and when we run any WP 
   CLI commands while we are cd’d into our theme, _your_ plugin is including _our_
   file.
 * As noted, this is an edge case but is pretty easy to fix by just adding `__DIR__`,
   same as you are already doing at the bottom of the file.
 * We made a very minimal theme to repro this which is available here: [https://github.com/vendi-advertising/vendi-minimum-theme](https://github.com/vendi-advertising/vendi-minimum-theme)
    1. Take a brand new WordPress site
    2. Install and activate the modal-window plugin
    3. Install and activate the theme (don’t bother browsing to it in a browser)
    4. cd into the vendi-minimum-theme directory
    5. Try running a WP CLI command such as `wp cache flush`, and you should see a 
       die message along with a stack trace showing who is requesting for it to be 
       included.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [DmtLo](https://wordpress.org/support/users/lobov/)
 * (@lobov)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/edge-case-bug-with-require-include-and-wp-cli/#post-17171554)
 * Hello.
 * Thanks for your feedback. I fixed this issue and updated the plugin to version
   5.3.8
 * Thanks again
 *  Thread Starter [cjhaas](https://wordpress.org/support/users/chrisvendiadvertisingcom/)
 * (@chrisvendiadvertisingcom)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/edge-case-bug-with-require-include-and-wp-cli/#post-17172703)
 * Thanks for your very quick response and resolution!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Edge-case bug with require/include and WP-CLI’ is closed to new replies.

 * ![](https://ps.w.org/modal-window/assets/icon-256x256.png?rev=1470847)
 * [Modal Window - create popup modal window](https://wordpress.org/plugins/modal-window/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/modal-window/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/modal-window/)
 * [Active Topics](https://wordpress.org/support/plugin/modal-window/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/modal-window/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/modal-window/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [cjhaas](https://wordpress.org/support/users/chrisvendiadvertisingcom/)
 * Last activity: [2 years, 6 months ago](https://wordpress.org/support/topic/edge-case-bug-with-require-include-and-wp-cli/#post-17172703)
 * Status: resolved