Child post with numeric only slug keeps redirecting to parent

I modified the allow-numeric-stubs plugin code to work with CPTs. You can view my forked repository here: https://github.com/akshatkedia/allow-numeric-stubs

WordPress is now allowing numeric slugs for CPTs but when I visit a child post with a numeric slug it redirects to the parent post automatically. So for example I have a Programmes CPT. There is a parent program with the slug: programmes/city-in-visible/ and a child program with the slug: programmes/city-in-visible/2009/

Visiting programmes/city-in-visible/2009/ redirects to programmes/city-in-visible/

That should not happen. How can I prevent this from happening?

Topic child-pages slug permalinks redirect custom-post-types Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.