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

Usage

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

You can specify global options and the following:

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

Source code of the commands