How to set post slug when using wp_insert_post();? April 6, 2022 by Tarik Billa The parameter to insert a custom slug is: 'post_name' => 'my-custom-slug' Not post_slug as one would think! 🙂