-
Notifications
You must be signed in to change notification settings - Fork 7
/
orphan-command.php
47 lines (44 loc) · 1.83 KB
/
orphan-command.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* Orphan Command
*
* @package HumanMade\OrphanCommand
* @author Human Made
* @copyright 2023 Human Made
* @license GPL-3.0-or-later
*
* @wordpress-plugin
* Plugin Name: Orphan Command
* Plugin URI: https://github.com/humanmade/orphan-command
* Description: WP-CLI command to list and delete orphan WordPress entities and metadata.
* Version: 1.1.1
* Requires at least: 3.3
* Requires PHP: 7.2
* Author: Human Made
* Author URI: https://humanmade.com/
* Text Domain: orphan-command
* License: GPL v3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt
*/
if ( ! class_exists( 'WP_CLI' ) ) {
return;
}
$wpcli_orphan_autoloader = __DIR__ . '/vendor/autoload.php';
if ( is_readable( $wpcli_orphan_autoloader ) ) {
include_once $wpcli_orphan_autoloader;
}
unset( $wpcli_orphan_autoloader );
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 );
WP_CLI::add_command( 'orphan post meta', HumanMade\OrphanCommand\Orphan_Post_Meta_Command::class );
WP_CLI::add_command( 'orphan revision', HumanMade\OrphanCommand\Orphan_Revision_Command::class );
WP_CLI::add_command( 'orphan term meta', HumanMade\OrphanCommand\Orphan_Term_Meta_Command::class );
WP_CLI::add_command( 'orphan user meta', HumanMade\OrphanCommand\Orphan_User_Meta_Command::class );