wp_insert_post – How do I prevent incremental numbers on child pages?

This is about a year over due.

I have had a similar thing happen on my new word press install.
Creating pages dynamically and getting incremental numbers on the slug names.

During this process I realised that the original slug would access the last one.

ie. ../../dynammic-page would access ../../dynamic-page-4

The solution was in the trash folder! WordPress maintains these old files. A new page of the same name and slug name will be assigned a slug with an increment.

I permanently deleted the trashed versions of the page and the newly created dynamic page was increment free. Hazzaar!

Hope that helps someone.

xK