I assume the cap has been overtightened and wont budge.
Use a 24mm socket with a breaker bar or T bar, try to counterhold the body with a strap wrench. Apply load to the bar then hit the end with a hammer, hopefully the shock will unstick the cap.
Sometimes the whole filter body comes loose from the block b4 the cap moves. If this happens then pull the body away from the block as you turn it and with luck the fastening bolt will unsecrew from the block. You then have to use heat / vice / strapwrench etc to separate cap from body. You will need a now seal for the body-block joint.
Dont use an open-ended spanner on the oil pipe flare nuts, you will squash the nuts and have problems refitting them. Buy or borrow a 19mm crowsfoot socket. You can use a flare nut spanner but you will need one which has the end slightly cranked wrt the shaft....straight spanners wont do.