Check if a Page has any Children or Subpages

To check if a page has any children/subpages, insert the following into your functions.php file,

then in your template call it as follows (within an if statement usually):

About Jean Galea

Jean Galea is a WordPress developer, entrepreneur and padel player. He is the founder of WP Mayor, the plugins WP RSS Aggregator and EDD Bookings, as well as the podcast. His personal blog can be found at

Related Articles