I am writing a class to create metaboxes and save the form data. The problem is, I keep getting a warning when I click "publish":

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function Mighty_Metabox not found or invalid function name"

Some of the things I know: The meta box shows on page load. The save function is called on page load. The warning above is returned on publish. The save function is not called on publish.

Do I need to put the save_post action hook somewhere else? Am I getting the wordpress integration into my class completely wrong? Some help on how and when to call methods like the save method would be greatly appreciated:

FYI: I am fairly new to OOP programming. I have been looking at the codex for metaboxes in order to learn more, but their class just seems like a wrapper for some code and doesn't seem to allow you to instantiate it - I may be wrong in thinking this.

That seems to have done it! Thank you very much. So, how come my constructor method wouldn't work? I thought it was good OOP PHP practice to use one the way I did. But your way works, so I can't complain! Now I just need to learn about the rest of the save_post functionality!
–
DannyFeb 28 '13 at 12:37

I think I was a bit quick to check this as the answer, it has solved half of the issue - the error is no longer displayed. But the _save method does not get called when publish is clicked. Any idea's?
–
DannyFeb 28 '13 at 13:37

I have checked it and it is getting called. You can check it by adding this code in _save method : echo '_save gets called'; exit();
–
Vinod DalviMar 1 '13 at 4:22

Correct me if I'm wrong, but the '_save' method is meant to be called on page load - which is working - and what I believe you are referring to. However it does not get called when 'publish' is clicked, therefore no attempt to save metadata can be made in the '_save' method.
–
DannyMar 1 '13 at 10:06