If you weren't married, you must establish paternity (maternity being established at birth, usually) and get a separate court case dealt with, and it does not apply if the person isn't the kid's biological parent.
As I recall, California has paternity laws I find particularly pernicious. You're deemed to be the father if you are named as such on the birth certificate, and are therefore responsible for support. The nasty part is that proving you are not the parent- which otherwise costs very little- does not automatically cease your legal responsibility for support. Instead, you must prove this in a court case, during which time you are still responsible for support of the child. This takes time and money...during which time you're still paying support, of course.
The nastiest part, though, is that the unearned back payments are not automatically refunded, either. Not only do you have to remember to ask for those in your pleadings or a motion, the court is not obligated to award you those mistaken payments.
The overall justification is, of course, "best interests of the child", which, while laudable and the standard in all states, has been taken a bit too far in that state. Last I heard, there are cases pending challenging this law. Surprise, surprise.