Repeating a function from another plugin.
-
I have a WooCommerce/Gravity Form plugin that uses the following line to add an options metabox to the editor page of a WooCommerce product:
add_meta_box( 'woocommerce-gravityforms-meta', __( 'Gravity Forms Product Add-Ons', 'wc_gf_addons' ), array($this, 'new_meta_box'), 'products', 'normal', 'default' );
I’ve added other custom post types that are now recognised as products by WooCommerce, and I’d like that metabox to be displayed for them as well. I can achieve this if I edit the plugin and duplicate that line, swapping the ‘products’ value for the name of the custom post type (E.g. ‘Speakers):
add_meta_box( 'woocommerce-gravityforms-meta', __( 'Gravity Forms Product Add-Ons', 'wc_gf_addons' ), array($this, 'new_meta_box'), 'speakers', 'normal', 'default' );
This, however, would obviously break as soon as the plugin updated, so I’d like to write a new plugin that just extends it to add that metabox onto the new post types.
How could I go about doing that? I’ve tried to just use that new line in the plugin and call the original plugin with require_once, but that doesn’t seem to have any effect.
- The topic ‘Repeating a function from another plugin.’ is closed to new replies.