• Hi All,

    I’m using the following snippet of code to add a post:

    $post_args = array(
    	'post_content'   => 'test test',
    	'post_name'      => 'slughere',
    	'post_title'     => 'title',
    	'post_status'    => 'pending',
    	'ping_status'    => 'closed',
    	'comment_status' => 'closed'
    );
    
    $new_post_id = wp_insert_post( $post_args );

    If I add a post with a ‘publish’ status, it works. But when I post it as a ‘pending’ post, for some reason the slug is not being added. It just stays empty.

    Does anybody have any idea how this is possible of why this is happening?

    Running the latest WP and even updated the core again to be sure there is nothing weird going on there.

    [Please don’t bump]

  • The topic ‘No slug when adding a pending post’ is closed to new replies.