[wp-hackers] New add_meta_box function

Jennifer Hodgdon yahgrp at poplarware.com
Tue Feb 19 18:02:40 GMT 2008


So, I'm trying to use the new add_meta_box function in a plugin. The 
issue I have is that I want to have a plugin that works for old and 
new WP versions. So I put in this logic:

if( function_exists( 'add_meta_box' )) {
   add_meta_box( something );
  } else {
   add_action('dbx_post_advanced', something );
  }

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.

Thoughts? Is this a bug I should file in Trac, that 
wp-admin/template.php needs to be included before the plugins are 
loaded, or is this just something the plugin has to work around (e.g. 
put this logic into an init function or something like that)?

      --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