/** * Remove a field. * * @access public * * @param string $object_type Object type, set true to remove all fields. * @param string $id Field ID to remove, set true to remove all fields from an object. * @param string $object_name Object name (for post types and taxonomies), set true to remove to all objects from an object type. */ public function remove_field($object_type, $id, $object_name = null) { if (true === $object_type) { // Remove all fields self::$fields = array(); } elseif (true === $object_name) { // Remove all fields for an object type if (isset(self::$fields[$object_type])) { unset(self::$fields[$object_type]); } } else { if (empty($object_name) && !empty($object_type)) { $object_name = '_' . $object_type; // Default to _object_type for internal handling } if (true === $id && null !== $object_name) { // Remove all fields for an object type if (isset(self::$fields[$object_type][$object_name])) { unset(self::$fields[$object_type][$object_name]); } } elseif (isset(self::$fields[$object_type][$object_name][$id])) { // Remove field from object type and name unset(self::$fields[$object_type][$object_name][$id]); } } }