[wp-hackers] Getting user info as early as possible.

Andy Skelton skeltoac at gmail.com
Sat Mar 18 03:54:18 GMT 2006


On 3/17/06, Jamie Talbot <wphackers at jamietalbot.com> wrote:
> Hi,
>
> Having get_currentuserinfo() as pluggable is nice, but what if I actually want to get the current
> user info during plugin setup, without redefining it myself?

This brings up an important point, one which will be repeated until
the end of time.

Plugin loading time is not the time to execute code. It is the time to
define functions and add actions/filters for later execution.

The reason for this is simple and it will not be argued here: the
program is not completely loaded until after the plugins and pluggable
functions are loaded. Refer to wp-settings.php to see which hooks
happen where.

Most plugins shouldn't actually do anything until init or later.

There are exceptions.

Andy


More information about the wp-hackers mailing list