Very similar to a bug that was previously reported - (NO BUG: MetaBox CPT hierarchical children Invalid Post Type)
When trying to edit child posts of a custom post type, I am getting an error to say invalid post type. You can see from the screenshot below that the child pages don’t have the bricks tag next to it.
I have the same problem… also using a plugin that removes the CPT slug.
As soon as I try to open the Bricks Templates I get the error “Invalid Post Type”
Thanks for the code. However, the error is not related to Bricks.
Once you applied those code, the rewrite rules in WordPress is messed up when you have a child post.
( Example: yoursite.com/service-1/sub-service, WordPress don’t know what page is this)
You can try to view the child post in frontend and you should be directed to the 404 page.
You will see the same in different themes as well.
PS: Query monitor plugin Request tab can help you understand currently using which rewrite rules on the page.