[wp-trac] [WordPress Trac] #14728: capabilities.php does not include pluggable.php
WordPress Trac
wp-trac at lists.automattic.com
Sun Aug 29 21:43:46 UTC 2010
#14728: capabilities.php does not include pluggable.php
--------------------------+-------------------------------------------------
Reporter: BlaenkDenum | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.0.1
Severity: normal | Keywords: reporter-feedback close
--------------------------+-------------------------------------------------
Comment(by nacin):
It's giving you a fatal error because it is too early to perform tasks or
actions based on the user that is logged in. The alternative is to
silently fail, but it's much better to allow functions to throw fatal
errors that way plugin authors realize it doesn't work.
Please don't include pluggable.php yourself -- that can break a lot of
plugins. The proper way to do this is to make sure your plugin doesn't
execute anything when it is included, beyond add_action/add_filter calls.
Then start processing your plugin on the initialization hook (init).
A plugin should be encapsulated so as not to run any heavy code when it is
first included, and instead wait for hooks. This is but one reason why.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14728#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list