public static function delete_post_type($type) { // refresh the cache from the DB, just to be sure $types = self::list_all_post_types(true); if (array_key_exists($type, $types)) { // Exists in DB.. check if there are content with this type. if (!DB::exists('{posts}', array('content_type' => Post::type($type)))) { // Finally, remove from database and destroy tokens DB::delete('{posttype}', array('name' => $type)); ACL::destroy_token('post_' . Utils::slugify($type)); // now force a refresh of the caches, so the removed type is no longer // available for use self::list_active_post_types(true); self::list_all_post_types(true); return true; } } return false; }