Many of you will remember that a couple of years ago, @ericlewis and a group of us set out to start a project to make sense of all of the different APIs that arose from third party plugins and themes to build custom field solutions on top of WordPress. That project was nicknamed “Metamorphosis” and subsequently went by the “Metadata UI/API” project. As plugin authors dealing with and using custom fields and content types, we had been tackling the issues of developing for multiple object types in WordPress for years prior to getting together. Now, @helen and I are pleased to (re)introduce to you what we’re hoping to be the fruits of all of this labor: Meet the new Fields API project. function fields_api_example_post_field_register( $wp_fields ) { // 1. Define a new section (meta box) for fields to appear in $wp_fields->add_section( 'post_type', 'my_cpt', 'my_meta_box', array( // Visible title of section 'title' => __( 'My Meta Box', 'mytheme' ), // Determines what order this appears in 'priority' => 'high', // Determines what order this appears in 'context' => 'side', // Capability needed to tweak
Share This