protected function insertNewPost( $post_type, $p, $html, $chapter_parent, $post_status ) {

		$new_post = [
			'post_title' => wp_strip_all_tags( $p['post_title'] ),
			'post_name' => $p['post_name'],
			'post_type' => $post_type,
			'post_status' => ( 'part' === $post_type ) ? 'publish' : $post_status,
			'post_content' => $html,
		];

		if ( 'chapter' === $post_type ) {
			$new_post['post_parent'] = $chapter_parent;
		}

		$pid = wp_insert_post( add_magic_quotes( $new_post ) );

		return $pid;
	}
protected function insertNewPost( $post_type, $p, $html, $chapter_parent, $post_status ) {

		$new_post = [
			'post_title' => wp_strip_all_tags( $p['post_title'] ),
			'post_name' => $p['post_name'],
			'post_type' => $post_type,
			'post_status' => ( 'part' === $post_type ) ? 'publish' : $post_status,
			'post_content' => $html,
		];

		if ( 'chapter' === $post_type ) {
			$new_post['post_parent'] = $chapter_parent;
		}

		$pid = wp_insert_post( add_magic_quotes( $new_post ) );

		return $pid;
	}
protected function insertNewPost ( $ post_type , $ p , $ html , $ chapter_parent , $ post_status ) { $ new_post = [ 'post_title' => wp_strip_all_tags ( $ p [ 'post_title' ] ) , 'post_name' => $ p [ 'post_name' ] , 'post_type' => $ post_type , 'post_status' => ( 'part' === $ post_type ) ? 'publish' : $ post_status , 'post_content' => $ html , ] ; if ( 'chapter' === $ post_type ) { $ new_post [ 'post_parent' ] = $ chapter_parent ; } $ pid = wp_insert_post ( add_magic_quotes ( $ new_post ) ) ; return $ pid ; }
Insert a new post

@param string $post_type Post Type
@param array $p Single Item Returned From \Pressbooks\Modules\Import\WordPress\Parser::parse
@param string $html
@param int $chapter_parent
@param string $post_status

@return int Post ID
Insert a new post