What may be forgotten is that a substantial number of the Shuttle missions, especially the earlier ones, where deemed Classified. Per Space.com
In the early days of the space shuttle program, some of the missions were run jointly by NASA and the military. This was in part because the National Reconnaissance Office had successfully requested the shuttle's payload bay — the part of the shuttle that carried satellites be carried into space — be enlarged to accommodate large military satellites, according to Air & Space Magazine.
NRO also wanted polar shuttle missions, since polar missions make it possible to see the Earth's entire surface below (as opposed to equatorial missions, which are limited.) The Air Force went so far as to create a launch pad in Vandenberg, California for polar-orbiting space shuttle missions, but after the Challenger incident, plans to use the pad were permanently mothballed.1
In all, 10
Classified missions were flown.
It's interesting to note, as Smithsonian Magazine reports
[...] Neither the Air Force nor the NRO was ever comfortable relying exclusively on NASA’s vehicle, however. Delays in shuttle launches only increased their worry; even before the 1986 Challenger accident, they were looking for a way off the shuttle and back onto conventional rockets like the Titan.3
That alone should have been a great big hint that the whole Shuttle program was somewhat Quixotic, to say the least.
The military, as most here probably are aware, went on develop and fly their own uncrewed spacecraft, the X-373, which can stay in space for literally years,4 something which you can't do without the huge overburden of life support of the ISS,5 which, while somewhat self-sustaining, still requires continual resupply missions6 for consumables such as food at considerable cost to keep the human components ticking.
_______________
1 Space.com: Classified Shuttle Missions: Secrets in Space
2 Smithsonian Magazine: The Secret Space Shuttles
3 Wikipedia: Boeing X-37
4 Associated Press: Unmanned, solar-powered US space plane back after 908 days
5 New Space Economy: Sustaining Life in Space: The ISS Environmental Control and Life Support System
6 Wikipedia: Commercial Resupply Services