I’m using a WordPress plugin that adds a metabox to the post page via
add_meta_box( 'WPInsights', 'Insights', array(&$this,'draw_insights'), 'post', 'normal', 'high' );
I want to add a meta box the same way through my functions.php
file, but it says the first argument is supposed to be a valid callback (I assume it is referring to the use of &$this
because WPInsights
is a class and draw_insights()
is a function inside that class.
How can I write an add_meta_box
function for my functions.php
file that uses the WPInsights
class?
Hook into the action
add_meta_boxes
like this:I believe that the add_meta_box function does not function the same say the add_action function. The add_action reference states that it takes a callback but the add_meta_box function states that it takes a string that it uses as a callback. While the argument is named ‘callback’ it does not state that it will take any php callback as the add_action one does.