mirror of
https://ghproxy.net/https://github.com/JayWood/jw-wpcli-random-posts.git
synced 2025-08-21 03:29:09 +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
|
* default: post
|
||||||
* ---
|
* ---
|
||||||
*
|
*
|
||||||
* [--force]
|
* [--force-delete]
|
||||||
* : Force deletes posts, skips trash
|
* : Force deletes posts, skips trash
|
||||||
* ---
|
* ---
|
||||||
* default: false
|
* default: false
|
||||||
|
@ -150,8 +150,8 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
||||||
foreach ( $posts as $post_id ) {
|
foreach ( $posts as $post_id ) {
|
||||||
wp_delete_post( $post_id, $force_delete );
|
wp_delete_post( $post_id, $force_delete );
|
||||||
$progress->tick();
|
$progress->tick();
|
||||||
WP_CLI::success( sprintf( 'Deleted %d posts', count( $posts ) ) );
|
|
||||||
}
|
}
|
||||||
|
WP_CLI::success( sprintf( 'Deleted %d posts', count( $posts ) ) );
|
||||||
$progress->finish();
|
$progress->finish();
|
||||||
} else {
|
} else {
|
||||||
WP_CLI::success( 'No posts for the specified post type were found, skipped post deletion' );
|
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