A judge instructed Stormy Daniels’ attorney, Michael Avenatti, to choose this week between appearing in court on behalf of his client or going on cable news.

Avenatti chose television.

Color me shocked.

The California-based attorney “withdrew his motion to participate in the court battle involving the FBI raid of President Donald Trump's attorney's hotel and office” after receiving Judge Kimba Wood’s ultimatum, CNN reported.

The report adds, “Avenatti, who practices law in California, had requested to be admitted into the New York proceedings, but was met with fierce objection from the attorney for Michael Cohen, Trump's long-time lawyer, who cited Avenatti's frequent television appearances, public statements about Cohen's guilt and his release of Cohen's personal financial information.”

Judge Wood told Avenatti that he’d be admitted to the court only if he agreed to change his “conduct" and "stop your publicity tour." The judge explained that "this conduct is inimitable to giving Mr. Cohen eventually a fair trial."

Just so we’re all clear: The judge gave Avenatti the choice between representing his client in court or going on CNN and MSNBC, and Daniels' attorney chose cable news.

"Until you are admitted I don't expect you to stand here and be heard," Wood told the lawyer.

Avenatti later withdrew his motion to appear “without prejudice,” meaning he can apply again if he wants to take another crack at it.

Daniels claims Cohen threatened her personally when she first started talking about going public with the details of her alleged tryst with the president. Trump continues to deny he had an affair with the former adult actress.

It’s funny because you’d think appearing at a hearing involving the FBI’s raid on Cohen’s office would take priority over a 5- to 10-minute appearance on CNN, MSNBC or wherever.

But you’d be wrong, and there’s really nothing surprising about this.

Avenatti has been a media darling for the past four months, clocking in an absurd number of interviews on both cable and network television. The man is clearly loving the media spotlight, though he does recoil violently the moment reporters do their jobs and ask him uncomfortable questions.

The occasional difficult question aside, he’s clearly trying to leverage the easily marketable Daniels story into something bigger for himself. He denies he has any interest in doing a television show, but yeah. Sure, okay. That would be a bit more believable were it not for the fact that a) he is on television on a semi-permanent basis now and b) he withdrew from appearing in court on behalf of Daniels once it jeopardized his “publicity tour.”

Avenatti's choice to bail out of this court battle so that he can continue to appear on TV is so predictable, it’s not really even newsworthy. But it’s funny, and that counts for something.