Skip to content

Commit

Permalink
Throw error for multisite command if not multisite
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrommen authored Jul 24, 2023
1 parent 1f16f6f commit 1172f8d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion orphan-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@
}
unset( $wpcli_orphan_autoloader );

WP_CLI::add_command( 'orphan blog meta', HumanMade\OrphanCommand\Orphan_Blog_Meta_Command::class );
WP_CLI::add_command( 'orphan blog meta', HumanMade\OrphanCommand\Orphan_Blog_Meta_Command::class, [
'before_invoke' => function () {
if ( ! is_multisite() ) {
WP_CLI::error( 'This is not a multisite installation.' );
}
},
] );
WP_CLI::add_command( 'orphan comment', HumanMade\OrphanCommand\Orphan_Comment_Command::class );
WP_CLI::add_command( 'orphan comment meta', HumanMade\OrphanCommand\Orphan_Comment_Meta_Command::class );
WP_CLI::add_command( 'orphan post', HumanMade\OrphanCommand\Orphan_Post_Command::class );
Expand Down

0 comments on commit 1172f8d

Please sign in to comment.