WASHINGTON — On one recent Sunday Twitter tirade, President Trump scolded the autoworkers union, Hillary Clinton, “Saturday Night Live,” MS-13, three Fox News anchors, a lawyer working on special counsel Robert S. Mueller III’s team and the late Sen. John McCain.

Surprisingly spared from the online wrath were the dozen Republican senators who just days earlier joined Democrats in voting to terminate Trump’s border emergency declaration.

Also unscathed were seven Republican senators who supported a measure to end U.S. military involvement in Yemen. condemning Trump’s refusal to acknowledge Saudi Arabia’s role in the killing of U.S. resident Jamal Khashoggi.

For reasons that are not entirely clear, Trump appears to have ceased — at least temporarily — his public, intraparty Twitter warfare against GOP lawmakers who cross him.

It’s a sharp reversal from the first two years of his administration, when the president would regularly and publicly mock any congressional Republican by name — and Twitter handle — who voted against his interests or criticized his behavior.

Just ask former Tennessee Sen. “Liddle” Bob Corker or former Arizona Sen. Jeff “Flake-y” Flake, two of Trump’s favorite Twitter targets last year. He said that Sen. Lisa Murkowski of Alaska “really let the Republicans, and our country, down” and that Kentucky Sen. Rand Paul was “such a negative force,” after they opposed his efforts to repeal the 2010 healthcare law known as Obamacare.

Last June, Trump took aim at then-South Carolina Rep. Mark Sanford, calling him “bad,” “trouble,” and “unhelpful.” Sanford, who often criticized Trump, lost his 2018 GOP primary to Katie Arrington, who then lost what had been a reliably Republican House seat to a Democrat in November.

Trump’s last such rant against his own colleagues came in a blistering news conference the day after the midterm election, when he called out by name several House Republicans who had lost.

The one glaring exception to Trump’s newfound discretion appears to be McCain, who died of cancer last year. Trump reiterated Wednesday that he “was never a fan” of McCain, who also voted against Trump’s plan to repeal Obamacare, and complained as part of a multiday rant that he didn’t get a “thank you” for approving McCain’s state funeral.

But even when Sen. Johnny Isakson (R-Ga.) on Wednesday called Trump’s ongoing attacks against the late war hero “deplorable” — the same term Hillary Clinton once used to describe some of Trump’s supporters — Trump did not fire back at Isakson.

Theories abound about why Trump has slowed the attacks, and whether it can last. Some believe that the president has better relations with his party’s members of Congress, or that Trump has been convinced that he needs to allow GOP lawmakers in left-leaning districts to maintain some distance in order to win reelection in 2020.

“I know the president would like 100% loyalty — who wouldn’t? But that said, I think the president has gained and is gaining an appreciation for just how independent each member is, particularly senators,” said Sen. Kevin Cramer (R-N.D.), who is close to the White House.

Since the beginning of the administration, GOP congressional leaders had been trying to persuade Trump to stop tweeting against other Republicans. Not only might he need those members’ votes, Trump was told, but a Twitter rebuke is costly at home for fellow Republicans — and GOP allies who occasionally vote against him are better for Trump’s agenda than Democrats who would never vote with him.

Those efforts are seemingly paying off, although in interviews with nearly a dozen Republican lawmakers and aides on Capitol Hill and in the administration, few were ready to declare a permanent change in Trump’s behavior, given the president’s unpredictability.

“My sense is the president is more comfortable in his role and is less worried about what they’re going to do,” said a senior White House official who requested anonymity to avoid alienating Trump or congressional officials. Trump, who often takes political setbacks personally, now sees that senators are making their own individual political calculations and that their votes are “not a slight on him.”

The changing dynamic also reflects a shift in the president’s agenda. During 2017, he was trying to enact legislation largely with only Republican support. His biggest obstacles were moderate GOP lawmakers.

Now with a slim legislative agenda on Capitol Hill and increased attention on the Mueller investigation and the 2020 race, he is aiming his fire at Democrats.

He is also boosting Republicans in Congress, whom he will need to defend him on the Russia investigation.

It doesn’t hurt that congressional Republicans seem to have figured out how to deal with the president, according to GOP officials.

For instance, many of the senators who voted against the White House’s position on the emergency declaration — including Sen. Mitt Romney (R-Utah) — were able to tell the president in person during an unrelated trade meeting how they were going to vote, emphasizing that it wasn’t a personal censure.

Trump speaks to lawmakers more often than he did in the early days of his administration, according to these Republicans, and is kept informed on their positions, preventing surprises that could prompt an online tirade.

“They’ve gotten used to each other,” said one Republican congressional aide.

While Trump did issue a few general threats that GOP senators voting against his emergency declaration would be seen as being soft on crime and border security, it was noteworthy that he didn’t single out any lawmakers by name, as he had in the past.

It is unclear whether the lack of tweets against Republican senators facing competitive races is a blip or a long-term change in strategy that could help Republicans seeking reelection in 2020. But Trump’s own reelection effort will rely in part on keeping Republicans united in some of the states in which GOP senators are on the ballot, such as North Carolina and Colorado.

“We’re all on the same team here … politically. Maybe that’s what is driving this latest decision,” said Sen. Shelley Moore Capito, a Republican who is seeking reelection in West Virginia next year.

There are also signs the White House is working behind closed doors on some of the congressional lobbying that Trump once did publicly.

When Sen. Thom Tillis (R-N.C.) announced in an op-ed that he would vote to disapprove of the emergency declaration, Trump didn’t send a tweet. Vice President Mike Pence and White House officials were dispatched to pressure Tillis, however, and he eventually fell in line behind Trump, arguing that he got an agreement from the White House to work on implementing broader limits to presidential emergency powers rules.

And instead of calling out the senators who opposed his administration’s position on Yemen or the emergency declaration, Trump’s tweets were more positive, emphasizing how many Republicans were with him.

He thanked “the Great Republican Senators who bravely voted for Strong Border Security and the WALL,” and predicted “when you get back to your State, they will LOVE you more than ever before!”