Title: Include path risk
Last modified: May 10, 2023

---

# Include path risk

 *  [remo o](https://wordpress.org/support/users/remomoddit/)
 * (@remomoddit)
 * [3 years ago](https://wordpress.org/support/topic/include-path-risk/)
 * Hello!
 * The main plugin file executes some `include()` statements without a directory
   specified. The danger is that the included files will first be looked for in 
   the current working directory (depends on the configuration, but apparently many
   systems have “.” as the first entry in their `include_path`). This caused an 
   issue for me where the theme `functions.php` ran too early, because I used `wp-
   cli` from the theme directory.
 * The safe way would be to specify the exact directory of the file to be included,
   using PHP constant `__DIR__` or `plugin_dir_path(__FILE__)`!
 * The issue can be reproduced in some ways:
   – Use `wp-cli` from your theme folder.
   If your `functions.php` uses Woocommerce code it will crash, because WC is loaded
   after woocommerce-email-test.– Place a `functions.php` (or `email-trigger.php`)
   in your website root, now the plugin will load this file instead of its own when
   used normally from a browser!

The topic ‘Include path risk’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woocommerce-email-test_252526.svg)
 * [WooCommerce Email Test](https://wordpress.org/plugins/woocommerce-email-test/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-email-test/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-email-test/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-email-test/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-email-test/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-email-test/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [remo o](https://wordpress.org/support/users/remomoddit/)
 * Last activity: [3 years ago](https://wordpress.org/support/topic/include-path-risk/)
 * Status: not resolved