|
10 | 10 | require_once $wpcli_language_autoloader;
|
11 | 11 | }
|
12 | 12 |
|
| 13 | +$wpcli_language_check_requirements = function() { |
| 14 | + if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) { |
| 15 | + WP_CLI::error( 'Requires WordPress 4.0 or greater.' ); |
| 16 | + } |
| 17 | +}; |
| 18 | + |
13 | 19 | WP_CLI::add_command( 'language core', 'Core_Language_Command', array(
|
14 |
| - 'before_invoke' => function() { |
15 |
| - if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) { |
16 |
| - WP_CLI::error( 'Requires WordPress 4.0 or greater.' ); |
17 |
| - } |
18 |
| - }) |
| 20 | + 'before_invoke' => $wpcli_language_check_requirements ) |
19 | 21 | );
|
20 | 22 |
|
21 | 23 | WP_CLI::add_command( 'language plugin', 'Plugin_Language_Command', array(
|
22 |
| - 'before_invoke' => function() { |
23 |
| - if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) { |
24 |
| - WP_CLI::error( 'Requires WordPress 4.0 or greater.' ); |
25 |
| - } |
26 |
| - }) |
| 24 | + 'before_invoke' => $wpcli_language_check_requirements ) |
27 | 25 | );
|
28 | 26 |
|
29 | 27 | WP_CLI::add_command( 'language theme', 'Theme_Language_Command', array(
|
30 |
| - 'before_invoke' => function() { |
31 |
| - if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) { |
32 |
| - WP_CLI::error( 'Requires WordPress 4.0 or greater.' ); |
33 |
| - } |
34 |
| - }) |
| 28 | + 'before_invoke' => $wpcli_language_check_requirements ) |
35 | 29 | );
|
36 | 30 |
|
37 | 31 | WP_CLI::add_hook( 'after_add_command:site', function () {
|
|
0 commit comments