array( 'type' => 'integer', 'sanitize_callback' => 'chrnx_sanitize_episode_number', 'schema' => array( 'type' => 'integer', 'minimum' => 0, ), ), 'chrnx_episode_duration' => array( 'type' => 'string', 'sanitize_callback' => 'chrnx_sanitize_episode_duration', 'schema' => array( 'type' => 'string' ), ), 'chrnx_episode_participants' => array( 'type' => 'array', 'sanitize_callback' => 'chrnx_sanitize_episode_participants', 'schema' => array( 'type' => 'array', 'items' => array( 'type' => 'string' ), ), ), 'canonical_episode_url' => array( 'type' => 'string', 'sanitize_callback' => 'chrnx_sanitize_canonical_episode_url', 'schema' => array( 'type' => 'string', 'format' => 'uri', ), ), ); foreach ( $definitions as $meta_key => $definition ) { register_post_meta( 'post', $meta_key, array( 'type' => $definition['type'], 'single' => true, 'show_in_rest' => array( 'schema' => $definition['schema'] ), 'sanitize_callback' => $definition['sanitize_callback'], 'auth_callback' => 'chrnx_auth_podcast_meta', ) ); } } add_action( 'init', 'chrnx_register_podcast_meta' );