[wp-hackers] New add_meta_box function

Jennifer Hodgdon yahgrp at poplarware.com
Tue Feb 19 19:33:22 GMT 2008


Jennifer Hodgdon wrote:
> 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...

Aargh. add_meta_box isn't apparently defined by the time the init 
function is called, either.

I think that's enough to say this is broken... I'll file in Trac.

     --Jennifer

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