WASHINGTON—President Trump has been threatening to close down the government if Congress doesn’t meet his immigration priorities, but he has privately agreed to put off a potential shutdown or any fight over border wall funding until after the midterm elections, an administration official said Monday.

In recent days Mr. Trump has been warning that he will accept a shutdown when government funding expires on Sept. 30 unless Congress toughens the nation’s immigration laws and comes up with more money for a wall on the Mexican...