/** * Remove a section. * * @access public * * @param string $object_type Object type, set true to remove all sections. * @param string $id Section ID to remove, set true to remove all sections 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_section($object_type, $id, $object_name = null) { if (true === $object_type) { // Remove all sections self::$sections = array(); } elseif (true === $object_name) { // Remove all sections for an object type if (isset(self::$sections[$object_type])) { unset(self::$sections[$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 sections for an object type if (isset(self::$sections[$object_type][$object_name])) { unset(self::$sections[$object_type][$object_name]); } } elseif (isset(self::$sections[$object_type][$object_name][$id])) { // Remove section from object type and name unset(self::$sections[$object_type][$object_name][$id]); } } }