Need to find out if a particular page on your WordPress website is a Child or not? This code will allow you to do just that.
Using this function returns true of false if the page the user is on equals the $pid or is a child/ancestor of the page.
The is_child() function can be used by passing the ID or the SLUG.
Both is_child(14) and is_child(“about-us”) are accepted.
There are many ways to use this function so be creative!