In his tweet, Mr. Trump was referring to a federal judge’s decision to dismiss a defamation suit filed by Ms. Clifford, who is known professionally as Stormy Daniels. The judge also ordered Ms. Clifford to pay the president’s related legal fees.

The president’s use of the term “horseface” was jarring, even though he has previously used similar disparaging language to describe women who challenge him. But it could also prove problematic for Republicans facing female opponents in the upcoming midterm elections, now just weeks away.