0, 'hide_if_empty' => false, 'taxonomy' => 'category', 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => true, 'show_option_none' => __('None')) ); exit(); } $post_time = time() ; // 初始化发贴信息 $post_info = array( 'post_status' => 'publish', 'post_type' => 'post', 'post_author' => 1, 'ping_status' => get_option( 'default_ping_status' ), 'comment_status' => get_option( 'default_comment_status' ), 'post_pingback' => get_option( 'default_pingback_flag' ), 'post_parent' => 0, 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', 'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => $post_excerpt, 'import_id' => 0, 'post_content' => $post_content, 'post_title' => $post_title, 'post_category' => array($post_category_id), 'post_name' => trim($post_name), 'post_date_gmt' => get_gmt_from_date(gmdate('Y-m-d H:i:s', $post_time + ( get_option( 'gmt_offset' ) * 3600 ))), 'post_date' => gmdate('Y-m-d H:i:s', $post_time + ( get_option( 'gmt_offset' ) * 3600 )), 'tags_input' => array_unique(array_filter(explode(',', $tags))), ); // 发布文章 $pid = wp_insert_post($post_info); if ($pid) { echo "[OK] $pid Ok"; } else { exit('error'); } ?>