bobbingwide / oik-batch

Batch interface to WordPress
https://www.oik-plugins.com/oik-plugins/oik-batch
GNU General Public License v2.0
0 stars 0 forks source link

Consider solutions for the is_admin() problem #32

Open bobbingwide opened 5 years ago

bobbingwide commented 5 years ago

A number of plugins expect to be run in two modes. Where is_admin() is either true or false. They do not expect to be called in batch mode. This can lead to problems when running in batch mode. Some routines will fail one way, others will fail another.

Specific problems are: #29, #31

What do we do about it?

Notes - What does WP-cli do?

WP-cli has suffered this problem for years. See https://github.com/wp-cli/wp-cli/pull/674 There does not appear to be a formally agreed solution. Some people use a temporary PHP file

define( 'WP_ADMIN', true );

and invoke WP-cli passing the file name in the --require parameter.

wp --require=make-admin.php activate easy-digital-downloads

Alternatively, you can use --skip-plugins and/or --skip-themes

e.g.

wp --skip-plugins=akismet