and welcome!
It would be helpful to have code that is more complete and shows how you are calling these methods. However, one thing I see that is likely responsible for at least part of your problem is the way in which you are calling add_meta_box()
.
add_meta_box()
should be called during the add_meta_boxes
action. I’ve never tried running it as a callback of register_post_type()
before. But, assuming that you are running register_post_type()
during init
, I imagine that add_meta_box()
would run during init
too – before the function is available.
If WP is actually trying to run the add_meta_box()
before it is available, you should be able to see a Fatal Error
in your PHP logs because of calling an undefined function.
To troubleshoot, I’d first confirm that your register_meta_box_cb
is working by simply having it call a function that will die;
or write a something to a file.
After you confirm that it is working, you can try having the register_meta_box_cb
call a function that will add an action to add_meta_boxes
. Have the callback to that add_meta_boxes
action run your add_meta_box()
loop.
Let me konw if that doesn’t work or you need some more help!