By default Plugin is adding the meta boxes for page and post. But you can enable / disable the meta boxes using filters. GWG have a filter “gwg_support_post_types”. Using this filter you can add the meta box in you CPT’s or remove from existing post type.
Removing the meta boxes for Post
Add the following code in your functions.php file. Here is the snippet:
/** * Removing GWG metaboxes for Post type */ add_filter( 'gwg_support_post_types', 'gd_remove_gwg_post_metabox' ); function gd_remove_gwg_post_metabox( $post_types ) { $post_types = array('page'); return $post_types; }
Add the meta boxes at Custom Post Type
Assume you have “product” post type. Then you will add following script in your functions.php file:
/** * Adding GWG metaboxes for "product" post type */ add_filter( 'gwg_support_post_types', 'gd_remove_gwg_post_metabox' ); function gd_remove_gwg_post_metabox( $post_types ) { $post_types[] = "product"; return $post_types; }
If you have multiple post types like “portfolio”, “products”, “books” then you will try this code:
/** * Adding GWG metaboxes into multiple post types * * Meta boxes will appear for "page", "post", "portfolio", "products", "books" */ add_filter( 'gwg_support_post_types', 'gd_remove_gwg_post_metabox' ); function gd_remove_gwg_post_metabox( $post_types ) { $post_types = array_merge( $post_types, array( "portfolio", "products", "books" ) ); return $post_types; }
Leave A Reply