WordPress at a glance
Home Handbook WP-CLI Commands

wp eval-file

Loads and executes a PHP file.

Note: because code is executed within a method, global variables need to be explicitly globalized.

See also wp eval


wp eval-file {file} [{arg}...] [--skip-wordpress]

You can specify global options and the following:

The path to the PHP file to execute. Use '-' to run code from STDIN.
One or more arguments to pass to the file. They are placed in the $args variable.
Load and execute file without loading WordPress.

Source code of the commands