How do I run a PHP script from WordPress environment, like `wp shell`?
Yes, there is! I didn’t find it at first, but wp cli offers a command called eval-file which does what you want: $ echo ‘<?php echo is_wp_error(“foo”) ? 1 : 0;’ > example.php $ wp eval-file example.php 0