[wp-hackers] distinguish plugin options?

Otto otto at ottodestruct.com
Thu Jan 22 20:59:54 GMT 2009


On Thu, Jan 22, 2009 at 9:50 AM, Stephen Rider
<wp-hackers at striderweb.com> wrote:
> Okay, I have a quandry.
>
> I'm trying to figure out if there's any way to distinguish, in the
> wp_options table, core WordPress options from options set by plugins.  The
> only way I can think to do this is to (shudder) maintain a list of WP Core
> options, and if a particular option isn't on that list it must be from a
> plugin.
>
> That isn't a very good solution because it's fragile and manpower intensive
> -- I would have to maintain that list vigilantly and basically forever....
>
> Does anyone else have any suggestion as to how this might be accomplished?

If I wanted to figure it out, I'd add a hook to update_option, and
then have my hook run a debug_backtrace() to get the function call
stack. By examining that stack, you can determine what file made the
call to update_option, and if the file is in wp-content/plugins/*,
then it's a plugin's option and you'll know.

-Otto


More information about the wp-hackers mailing list