how to add custom meta field in custom post type

Solutions on MaxInterview for how to add custom meta field in custom post type by the best coders in the world

showing results for - "how to add custom meta field in custom post type"
Clementine
26 Jan 2020
1function global_notice_meta_box() {
2
3    $screens = array( 'post', 'page', 'book' );
4
5    foreach ( $screens as $screen ) {
6        add_meta_box(
7            'global-notice',
8            __( 'Global Notice', 'sitepoint' ),
9            'global_notice_meta_box_callback',
10            $screen
11        );
12    }
13}
14
15add_action( 'add_meta_boxes', 'global_notice_meta_box' );
16