1 year ago
While working on the WordPress website it’s almost impossible to skip creating meta boxes. The meta box is helpful for storing metadata about your page, post, or custom post types. true, 'label' => __( 'Team', 'surana' ), 'menu_icon' => 'dashicons-admin-users', 'show_in_rest' => true, 'has_archive' => true, 'supports' => array('title', 'editor', 'custom-fields'), // here custom-fields is compulsory 'rewrite' => array('slug' => 'team', 'with_front' => false), ); register_post_type( 'team', $args ); register_meta( 'post', 'designation', // meta key array( 'object_subtype' => 'team', // post type name here 'type' => 'string', 'single' => true, 'show_in_rest' => true, ) ); register_meta( 'post', 'degree', array( 'object_subtype' => 'team', 'type' => 'string', 'single' => true, 'show_in_rest' => true, ) ); register_meta( 'post', 'social_links', array( 'object_subtype' => 'team', 'type' => 'array', 'single' => true, 'default' => array(), 'show_in_rest' => array( 'schema' => array( 'type' => 'array', 'items' => array( 'type' => 'object', 'properties' => array( 'facebook' => array( 'type' => 'string' ), 'linkedin' => array( 'type' => 'string' ), ), )