JAKARTA, Indonesia — President Donald Trump said Wednesday he was unaware of any effort to move the USS John S. McCain that was stationed near the site of his recent speech in Japan.

Trump's denial came after The Wall Street Journal reported that the White House wanted the Navy to move the ship named for the late Arizona senator, as well as his father and grandfather, "out of sight," citing an email between military officials.

The email to Navy and Air Force officials had a number of directives, including: "USS John McCain needs to be out of sight," and asking officials to "please confirm" that directive "will be satisfied." Two sources with knowledge of the matter confirmed to CNBC the existence of that email.

The Journal said a tarp was hung over the ship's name ahead of Trump's trip and that sailors were directed to remove coverings from the destroyer that bore the McCain name. The newspaper also said sailors assigned to the ship, who generally wear caps bearing its name, were given the day off during Trump's visit to the nearby USS Wasp.

"I was not informed about anything having to do with the Navy Ship USS John S. McCain during my recent visit to Japan," Trump tweeted.

The Journal also said that acting Defense Secretary Patrick Shanahan had signed off on the measures to obscure the McCain. However, in a statement to CNBC, the Pentagon denied it. "Secretary Shanahan was not aware of the directive to move the USS John S. McCain nor was he aware of the concern precipitating the directive," the Pentagon said.

Shanahan later told reporters en route to Singapore: "I would never dishonor the memory of a great American patriot like Sen. John McCain."

"I'd never disrespect the young men and women that crew that ship. I've asked my chief of staff to look into the matter ... and as soon as I find out more about this I'll let you know," he added.

Commander Clay Doss, a spokesman for the Navy's Seventh Fleet, said the tarp was taken down on Saturday before Trump's visit to the area. "All ships remained in normal configuration during the President's visit," Doss said.

McCain, the unsuccessful 2008 Republican presidential nominee, was shot down during the Vietnam War and tortured by his North Vietnamese Communist captors during more than five years in captivity as a prisoner of war.

Trump has long criticized McCain on a variety of fronts, and has kept up his attacks on McCain even following his death in August.

Meghan McCain, the late senator's elder daughter, criticized Trump on Twitter on Wednesday, saying, Trump "will always be deeply threatened by the greatness of my dad's incredible life ... nine months since he passed, Trump won't let him RIP. So I have to stand up for him."

The USS John S. McCain is named for the late senator and his father and grandfather, who were both Navy admirals. The destroyer was involved in a 2017 collision that resulted in the deaths of 10 crew members and is currently undergoing repairs.

— CNBC's Ryan Ruggiero and Reuters contributed to this report.