Plugin submission denied for “Calling file locations poorly” when using WP_PLUGIN_DIR constant
I’ve submitted a plugin for review and it was not accepted for the following reason:
Calling file locations poorly
The way your plugin is referencing other files is not going to work with all setups of WordPress.
When you hardcode in paths like wp-content or your plugin folder name, or assume that everyone has WordPress in the root of their domain, you cause anyone using ‘Giving WordPress it’s own directory’ (a VERY common setup) to break. In addition, WordPress allows users to change the name of wp-content, so you would break anyone who chooses to do so.
Please review the following link and update your plugin accordingly. And don’t worry about supporting WordPress 2.x or lower. We don’t encourage it nor expect you to do so, so save yourself some time and energy.
Remember to make use of the FILE variable, in order than your plugin function properly in the real world.
Example(s) from your plugin:
require_once WP_PLUGIN_DIR.'/pluginname/inc/functions/single-post-ajax-callback.php'; require_once WP_PLUGIN_DIR.'/pluginname/inc/functions/generate-images-ajax-callback.php'; require_once WP_PLUGIN_DIR.'/pluginname/inc/functions/add-image-to-library-ajax-callback.php';
I don’t understand why this isn’t acceptable since I’m not hardcoding the ‘wp-content’ path, and I’m using the WP_PLUGIN_DIR constant.
Thanks in advance.
Leave an answer