X

Check If a Page is a Child (Advanced w/ ID or SLUG)

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!

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!