Is it true that a father gets total custody of a son when the boy is seven years if the marriage ends in divorce?

I am looking for an answer under Islamic law.

Answer

As a general rule, when a divorce takes place the right of custody in the
case of minor children is awarded to the mother first if she does not
remarry. This is effective in the case of a male upto the age of seven and
in the case of a female upto the age of nine. If she remarries then her
right of custody is thereafter passed on to her mother, children’s maternal
grandmother.

After the respective ages of seven and nine, the father has the right of
custody. However, both parents have visitation rights when the children are
not in his/her custody. Visitation rights should be mutually agreed. Apart
from the general rule, the overwhelming advantage of the children also plays
an integral part in determining the rights of custody. Somewhere on this
site, search ‘custody’ (without quotes)

and Allah Ta’ala Knows Best

Mufti Ebrahim Desai

Source