President Trump, who has had a tug-of-war with the press throughout his administration, has lately dialed up the frequency and intensity of his attacks at rallies around the country.

White House advisers and people close to the president say his broadsides against the media are in part a visceral response to what he sees as unfair criticism. But they also are part of a campaign strategy to energize Republican voters ahead of the midterm elections, targeting a frustration with the media that Mr. Trump shares with his supporters.

...