Today, S-traps break residential plumbing code as they do not offer a vent to the pipes. If your fixtures now drain through S-traps, you are not required to fix them as they are “grandfathered” in. An S-trap is a sign that your plumbing is outdated and should be rebuilt to meet current plumbing standards. If you cannot afford to hire a follow these steps for replacing your existing S-trap as the procedure is actually pretty easy and the parts do not cost much:
1.) Begin by attaching a banded coupling to the drain at floor level. From top of the coupling or adapter, use two 45-degree PVC elbows to offset a riser to the back wall of the cabinet (about 4 inches to the left or right of center)
2.) Bring the riser up to trap leve (about 18 inches off the floor) and install a sanitary T-fitting.
3.) Using a PVC ground-join trap adapter, pipe the trap into the riser.
4.) Out of the top of the T, extend the riser p 6 inches, ending with another 1 1/2 inch female adapter.
5.) Next, thread an automatic vent device into this adapter.
Automatic vent devises dont last indefinitely, so remove the vent every couple of years and check how it is opperating. With the vent in hand, its spring-loaded diaphragm should be held firmly against its seat. If the diaphragm is down even slightly or if the rubber has deteriorated it is time to install a whole new unit under your sink.
note first pic s trap 2nd pic correct p trap
(article content from “Plumbing – Basic, Intermediate & Advanced Projects“)