I recently developed 2 seperate wordpress plugins for one of my projects
- Partners
- Resource Library
Both plugins create custom post types fsb_partners
and fsb_resource_library
. And in both plugins I have created different metaboxes (partners plugin metabox contains one file field i.e. Logo and resource library plugin creates metabox with two file fields i.e. Audio and PDF).
I used following code to create metabox in each plugin:
add_filter( 'cmb_meta_boxes', array($this, "fsb_partners_metaboxes"), 999);
—> Partners Plugin
add_filter( 'cmb_meta_boxes', array($this, "fsb_resource_library_metaboxes"), 999);
—> Resource Library Plugin
Now only metabox at resource library plugin is visible and other is not. If I change the priority of partner plugin metabox to 9999
then it shows up but at the same time resource library plugins goes off.
I know it’s wordpress’s add_filter
hook’s priority issue, but am unable to get hands on it. Any help?
Fixed it myself. Just created a separate (common) function in my theme’s
functions.php
as follows: