hardcoded paths in community plugin
-
I paid for the upgrade before testing with the community version, which may have been ill-advised, because I was in a hurry and the feature I needed (submit from front end) was only available in premium. Still haven’t received that mysterious “email with plugin attached”, though, so I decided to give the community version a shot.
And I immediately found a big issue.
wats-head.php:60
$plugin_url = trailingslashit(get_option('siteurl')) . 'wp-content/plugins/' . basename(dirname(__FILE__)) .'/';
DUDE. DUDE. There are constants for a reason. I never, ever keep my plugins in “wp-content”. That’s where traps for skriptkiddies go. Update your files to use the plugin directory constants. Or better yet, if you are always pointing to files that are relative to your plugin, use the PHP magic constant for _FILE_…here’s how I do it:
$this->the_path = plugin_dir_path(__FILE__);
(of course this is inside a class structure)I hope I see that premium email soon. I’m intrigued by what you’ve got going here, but it’s just not portable with the hardcoded paths.
- The topic ‘hardcoded paths in community plugin’ is closed to new replies.