@@ -79,7 +79,7 @@ public function __construct() {
7979 * : The post name. Default is the sanitized post title when creating a new post.
8080 *
8181 * [--from-post=<post_id>]
82- * : The post id of a post to be duplicated.
82+ * : Post id of a post to be duplicated.
8383 *
8484 * [--to_ping=<to_ping>]
8585 * : Space or carriage return-separated list of URLs to ping. Default empty.
@@ -151,7 +151,7 @@ public function __construct() {
151151 * $ wp post create --post_title='A post' --post_content='Just a small post.' --meta_input='{"key1":"value1","key2":"value2"}
152152 * Success: Created post 1923.
153153 *
154- * # Create a duplicate post with same post data .
154+ * # Create a duplicate post from existing posts .
155155 * $ wp post create --from-post=123 --post_title='Different Title'
156156 * Success: Created post 2350.
157157 */
@@ -178,28 +178,28 @@ public function create( $args, $assoc_args ) {
178178 }
179179
180180 $ array_arguments = array ( 'meta_input ' );
181- $ assoc_args = \WP_CLI \Utils \parse_shell_arrays ( $ assoc_args , $ array_arguments );
182-
183- if ( isset ( $ assoc_args ['from-post ' ] ) ) {
184- $ post = $ this ->fetcher ->get_check ( $ assoc_args ['from-post ' ] );
185- $ post_arr = get_object_vars ( $ post );
186- $ post_id = $ post_arr ['ID ' ];
187- unset( $ post_arr ['post_date ' ] );
188- unset( $ post_arr ['post_date_gmt ' ] );
189- unset( $ post_arr ['guid ' ] );
190- unset( $ post_arr ['ID ' ] );
191-
192- if ( empty ( $ assoc_args ['meta_input ' ] ) ) {
193- $ assoc_args ['meta_input ' ] = $ this ->get_metadata ( $ post_id );
194- }
195- if ( empty ( $ assoc_args ['post_category ' ] ) ) {
196- $ post_arr ['post_category ' ] = $ this ->get_category ( $ post_id );
197- }
198- if ( empty ( $ assoc_args ['tags_input ' ] ) ) {
199- $ post_arr ['tags_input ' ] = $ this ->get_tags ( $ post_id );
200- }
201- $ assoc_args = array_merge ( $ post_arr , $ assoc_args );
181+ $ assoc_args = \WP_CLI \Utils \parse_shell_arrays ($ assoc_args , $ array_arguments );
182+
183+ if (isset ($ assoc_args ['from-post ' ])) {
184+ $ post = $ this ->fetcher ->get_check ($ assoc_args ['from-post ' ]);
185+ $ post_arr = get_object_vars ($ post );
186+ $ post_id = $ post_arr ['ID ' ];
187+ unset($ post_arr ['post_date ' ]);
188+ unset($ post_arr ['post_date_gmt ' ]);
189+ unset($ post_arr ['guid ' ]);
190+ unset($ post_arr ['ID ' ]);
191+
192+ if (empty ($ assoc_args ['meta_input ' ])) {
193+ $ assoc_args ['meta_input ' ] = $ this ->get_metadata ($ post_id );
194+ }
195+ if (empty ($ assoc_args ['post_category ' ])) {
196+ $ post_arr ['post_category ' ] = $ this ->get_category ($ post_id );
202197 }
198+ if (empty ($ assoc_args ['tags_input ' ])) {
199+ $ post_arr ['tags_input ' ] = $ this ->get_tags ($ post_id );
200+ }
201+ $ assoc_args = array_merge ($ post_arr , $ assoc_args );
202+ }
203203
204204 $ assoc_args = wp_slash ( $ assoc_args );
205205 parent ::_create ( $ args , $ assoc_args , function ( $ params ) {
0 commit comments