Depth-of-field also depends on how close you are to the subject.
If you're more than, say, fifteen feet from your subject, different lens openings will have about the same amounts of depth-of-field.
As you get closer to the subject, depth-of-field becomes more evident.
As you get closer and closer, the depth-of-filed decreases.
In the photograph below, very little is in focus because of the wide lens opening, f/4.5.
And, the camera is close to the marigolds.
In the next photograph, much more is in focus.
That's because the small lens opening, f/22, produced more depth-of-field.
If you're close to your subject, consider using a small lens opening, such as f/22.