How to enable Meta Box free extensions when Meta Box is embedded in a WordPress plugin or theme

The situation is this, we’ve embedded Meta Box (core) into our plugin Clay Framework (which powers this site, goldhat.ca). Everything works fine, and we added the Meta Box AIO (collection of all premium Meta Box extensions). Now so far AIO was just activated as a plugin, not embedded into Clay Framework. And all the premium extensions seem to work fine, though there are so many we haven’t had a chance to test them all yet! Where we ran into a bit of a snag was when we installed Meta Box Custom Post Types. This post types extension is not bundled into Meta Box AIO because it’s free (only premium Meta Box extensions are found in Meta Box AIO). And when we activated it, a notice appeared that said “Meta Box needs to be installed”.

Digging into the code we saw that Meta Box Custom Post Types plugin uses the “init” action to check if Meta Box is installed. The priority on that check is 0, which doesn’t leave a lot of room to integrate Meta Box before it’s called. We were able to solve that using -1 as the priority in our init hook call where we integrate Meta Box. I wasn’t sure if that would work because I didn’t know if “minus values” are supported as hook priorities, but apparently they are! Is it good practice though, could it cause some complications? I’m not sure, leave a comment if you know the answer to that.

For now we’ll continue setting -1 as our init priority to integrate Meta Box, and that solved the problem for the Meta Box Custom Post Types plugin. It now loads properly and seems to be functioning normally.