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 } }