protected function insertNewPost($post_type, $p, $html, $chapter_parent) { $custom_post_types = apply_filters('pb_import_custom_post_types', array()); $new_post = array('post_title' => wp_strip_all_tags($p['post_title']), 'post_type' => $post_type, 'post_status' => 'part' == $post_type || in_array($post_type, $custom_post_types) ? 'publish' : 'draft'); if ('part' != $post_type) { $new_post['post_content'] = $html; } if ('chapter' == $post_type) { $new_post['post_parent'] = $chapter_parent; } $pid = wp_insert_post(add_magic_quotes($new_post)); update_post_meta($pid, 'pb_show_title', 'on'); update_post_meta($pid, 'pb_export', 'on'); return $pid; }