title: Child page of parent page with same name as custom post type causes 404
body: <p>I've searched extensively on this issue and have found others with similar problems, but no solutions that work in my case.</p>
  
  <p>The situation is this: <br />
  * I have created a custom post type with the slug 'events'.<br />
  * I have created a page with the slug 'events'.<br />
  * I have added child pages to the events page (first-level children)<br />
  * I have added child pages to those child pages (second-level children)<br />
  * The permalink structure is set to /%category%/%postname%/<br />
  * I am not using any plugins or custom code to handle custom post types.<br />
  * When I navigate to /events/, the page loads fine using the pages.php template.<br />
  * When I navigate to /events/first-level-child/ I get a 404.<br />
  * When I navigate to /events/first-level-child/second-level-child/ the page loads fine using the page.php template.<br />
  * When I navigate to /events/category-name/ the page loads fine using the archive.php template.</p>
  
  <p>The problem is the 404 I get when trying to view a first-level child page of the page with the same slug as that of a custom post type.</p>
  
  <p>It is not an option for me to rename either of the slugs so that they're different. I need to find a way to get both child pages and categories to work as expected for the Events page. I cannot create custom redirects in the .htaccess file for the child pages as the client must be able to create them themselves.</p>
  
  <p>Is there some way to modify the rewrite rules generated by WordPress to achieve my goal? Or is there maybe a plugin that I could utilize that would help? I'm guessing that WordPress expects the second uri segment to be a category name. Is there a way to have it look for pages with that name if no category is found?</p>