mirror of
https://ghproxy.net/https://github.com/JayWood/jw-wpcli-random-posts.git
synced 2025-08-18 19:06:03 +08:00
Fix positional argument, move success message out of loop - fixes #3
This commit is contained in:
parent
ff5e1cce43
commit
2b2ecab735
1 changed files with 2 additions and 2 deletions
|
@ -30,7 +30,7 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
|||
* default: post
|
||||
* ---
|
||||
*
|
||||
* [--force]
|
||||
* [--force-delete]
|
||||
* : Force deletes posts, skips trash
|
||||
* ---
|
||||
* default: false
|
||||
|
@ -150,8 +150,8 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
|||
foreach ( $posts as $post_id ) {
|
||||
wp_delete_post( $post_id, $force_delete );
|
||||
$progress->tick();
|
||||
WP_CLI::success( sprintf( 'Deleted %d posts', count( $posts ) ) );
|
||||
}
|
||||
WP_CLI::success( sprintf( 'Deleted %d posts', count( $posts ) ) );
|
||||
$progress->finish();
|
||||
} else {
|
||||
WP_CLI::success( 'No posts for the specified post type were found, skipped post deletion' );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue