[wp-hackers] New add_meta_box function

Jennifer Hodgdon yahgrp at poplarware.com
Tue Feb 19 19:26:50 GMT 2008

Stephen Rider wrote:
> Maybe just check for version #?

Yes, I know that is possible, and I agree it is very very kludgy; much 
better practice to use function_exists in my opinion.

The reason that I asked was that Ryan et al, who removed the 
dbx_page_advanced action, suggested this method (checking for the 
add_meta_box function's existence), so I was hoping they'd weigh in on 
whether they planned to include the function early enough so that 
would work, or if they had a different suggestion, or if we needed to 
move this one action into the init function, or what. I haven't tested 
in init, by the way, to verify the function is defined then...


> On Feb 19, 2008, at 12:02 PM, Jennifer Hodgdon wrote:
>> 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.

Jennifer Hodgdon * Poplar ProductivityWare

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

More information about the wp-hackers mailing list