We present a novel rp‐adaptation strategy for high‐fidelity simulations of compressible inviscid flows with shocks. The mesh resolution in regions of flow discontinuities is increased by using a variational optimizer to r‐adapt the mesh and cluster degrees of freedom there. In regions of smooth flow, we locally increase or decrease the local resolution through increasing or decreasing the polynomial order of the elements, respectively. This dual approach allows us to take advantage of the strengths of both methods for best computational performance, thereby reducing the overall cost of the simulation. The adaptation workflow uses a sensor for both discontinuities and smooth regions that is cheap to calculate, but the framework is general and could be used in conjunction with other feature‐based sensors or error estimators. We demonstrate this proof‐of‐concept using two geometries in transonic and supersonic flow regimes. The method has been implemented in the open‐source spectral/hp element framework Nektar++, and adaptivity is performed by its dedicated high‐order mesh generation tool NekMesh. The results show that the proposed rp‐adaptation methodology is a reasonably cost‐effective way of improving simulation accuracy.