Sections 5324 and 5325 of the Domestic Relations statute sets out the circumstances under which grandparents and great-grandparents may petition for custody/visitation. Section 5324 deals with partial custody or visitation and requires that at least one of three conditions be met: (1) a parent of the child is deceased; (2) the parents of the child have been separated for at least six months and do not agree on partial custody/visitation to a grandparent or great-grandparent; or (3) the child has lived with the grandparents or great-grandparents for at least 12 consecutive months provided a petition is filed within six months after the child is removed from the home.

Section 5325 deals with standing to request primary physical custody as well as legal custody. Grandparents must establish the relationship began with the consent of the parents, they are willing to assume responsibility for the child and the child is substantially at risk due to parental abuse, neglect, drug or alcohol abuse or incapacity. After establishing standing, the best interests analysis that is conducted in all custody cases still applies and the court must weigh all relevant factors. Section 5328(c), concerning custody awards to grandparents and great-grandparents, requires the court to specifically consider amount of personal contact between the child and the grandparent prior to filing and whether an award of custody to a grandparent or great-grandparent would interfere with any parent-child relationship.