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

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

Activate an existing post type
public static activate_post_type ( string $type ) : boolean
$type string The post type to activate
Результат boolean True on success
    public static function activate_post_type($type)
    {
        $all_post_types = Post::list_all_post_types(true);
        // We force a refresh
        // Check if it exists
        if (array_key_exists($type, $all_post_types)) {
            if (!$all_post_types[$type]['active'] == 1) {
                // Activate it
                $sql = 'UPDATE {posttype} SET active = 1 WHERE id = ' . $all_post_types[$type]['id'];
                DB::query($sql);
            }
            return true;
        } else {
            return false;
            // Doesn't exist
        }
    }