Open the Shortcuts app, you should have it unless you’ve deleted it.
- Select automation from the bottom navigation
- press the plus, in the top right
- create personal automation
- select “app”
- click choose and choose which app
- then toggle either is opened or is closed
- click next
- click add action >
- type “orientation” in the search box at the top
- click set orientation lock.
Now it should say “Turn” on blue at the start of the action, if it says toggle or ask each time, click it and choose “Turn”. Finally choose On or Off at the end of the action.
Click next, uncheck ask before running (otherwise what’s the point) and click done.