Any rights to seek physical custody or legal custody rights and any custody rights that have been granted under section 5324 (relating to standing for any form of physical custody or legal custody) or 5325 (relating to standing for partial physical custody and supervised physical custody) to a grandparent or great-grandparent prior to the adoption of the child by an individual other than a stepparent, grandparent or great-grandparent shall be automatically terminated upon such adoption.