Habari\Post::delete_post_type PHP Метод

delete_post_type() публичный статический Метод

removes a post type from the database, if it exists and there are no posts of the type
public static delete_post_type ( string $type ) : boolean
$type string The post type name
Результат boolean true if post type has been deleted false if it has not been deleted (does not exist or there are posts using this content type)
    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;
    }