If you are talking about having the court record sealed, the courtroom closed to the public, or both, then although it is technically possible there would be a very high burden to meet. If the case is newsworthy, the media will generally oppose any such petition. You can also stipulate that certain evidence or testimony be taken under seal and not disclosed -- such as medical or mental health treatment records, certain information about the children, a custody evaluator's report and recommendation, and the like -- with consequences to the parties for disclosing the sealed information. Some states (I haven't checked yours) automatically seal certain types of information, such as a custody evaluator's recommendation, and some even allow for the court to order that the attorneys not provide copies to their clients.
If you are speaking of a gag order, such orders are also unusual. If you can negotiate some sort of order as part of your divorce settlement, then you can probably obtain some form of "gag order" that will limit or prevent certain forms of disparagement, harassment, or disclosure of embarrassing information from the relationship or divorce; but such a clause, and language describing the consequence of violation, should be drafted by and reviewed for enforceability by your lawyers.
In terms of what a court might order in the absence of agreement, a court may provide a limited restriction under special circumstances -- such as a provision that neither party shall disparage the other in the presence of their minor children, or limiting certain statements made (e.g., to the media) while the divorce is still pending; but a court has very little power to restrict the First Amendment rights of the parties to a divorce case. It is not the role of the court to protect you, after a break-up, from embarrassing facts about your past relationship. If your ex- tells falsehoods about you, then your remedy will normally lie with a defamation action.

