// register meta box
function meta_fields_add_meta_box(){
add_meta_box(
'meta_fields_meta_box',
__( 'Course Booking URL', 'textdomain' ),
'meta_fields_build_meta_box_callback',
'page',
'side',
'default',
// hide the meta box in Gutenberg
array('__back_compat_meta_box' => true)
);
}
add_action( 'add_meta_boxes', 'meta_fields_add_meta_box' );
// build meta box content
function meta_fields_build_meta_box_callback( $post ){
wp_nonce_field( 'meta_fields_save_meta_box_data', 'meta_fields_nonce' );
$paymenturl = get_post_meta( $post->ID, '_meta_fields_payment_url', true );
$courseid = get_post_meta( $post->ID, '_meta_fields_course_id', true );
?>
A meta box gets created on a post type page in the side and shows 2 fields and values from those 2 fields would be saved in post meta once the page is saved