OSDN Git Service

Store post ids during `wp post generate`.
authorMike Burns <mgburns@bu.edu>
Fri, 3 Jan 2014 20:29:05 +0000 (15:29 -0500)
committerMike Burns <mgburns@bu.edu>
Fri, 3 Jan 2014 20:29:05 +0000 (15:29 -0500)
Fixes --max_depth which was broken in fe2be3169b.
Closes #820.

php/commands/post.php

index 3f93268..3d57cf2 100644 (file)
@@ -316,6 +316,7 @@ class Post_Command extends \WP_CLI\CommandWithDBObject {
 
                $notify = \WP_CLI\Utils\make_progress_bar( 'Generating posts', $count );
 
+               $post_ids = array();
                $current_depth = 1;
                $current_parent = 0;
 
@@ -347,7 +348,7 @@ class Post_Command extends \WP_CLI\CommandWithDBObject {
                                'post_content' => $post_content,
                        );
 
-                       wp_insert_post( $args, true );
+                       $post_ids[$i] = wp_insert_post( $args, true );
 
                        $notify->tick();
                }