[wp-hackers] New add_meta_box function

Jennifer Hodgdon yahgrp at poplarware.com
Tue Feb 19 20:25:51 GMT 2008


Ozh wrote:
> On Feb 19, 2008 7:02 PM, Jennifer Hodgdon <yahgrp at poplarware.com> wrote:
>> The problem is that add_meta_box is not defined yet when the plugin is
>> loaded. Normally all the hooks in a plugin are added at that time,
>> using add_filter and add_action in the main body of the plugin (i.e.
>> not within a plugin function), but this doesn't work, because the file
>> containing this function hasn't been loaded yet when the plugin is
>> first loaded.

> I played a bit with add_meta_box() to understand how it works and had
> the same problem. So instead of hooking things in 'init' or
> 'plugins_loaded' I hooked them with 'admin_menu' -- at this time, the
> function exists.

Good idea. I've noted that on the bug report (Ryan indicates they 
probably don't want to load any more functions at startup), and in the 
Codex migrating page:

http://trac.wordpress.org/ticket/5924
http://codex.wordpress.org/Migrating_Plugins_and_Themes

    --Jennifer

-- 
Jennifer Hodgdon * Poplar ProductivityWare
www.poplarware.com

Drupal/WordPress Sites, Themes, Modules/Plugins
Custom Web Programming, Web Databases
Modeling/Analysis/Palm OS Software



More information about the wp-hackers mailing list