Skip to content

Commit 23b142f

Browse files
authored
Merge pull request #85 from wp-cli/regenerate-readme
Regenerate README file
2 parents 52a50c1 + b566d46 commit 23b142f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This package implements the following commands:
1616
Executes arbitrary PHP code.
1717

1818
~~~
19-
wp eval <php-code> [--skip-wordpress]
19+
wp eval <php-code> [--skip-wordpress] [--hook=<hook>]
2020
~~~
2121

2222
Note: because code is executed within a method, global variables need
@@ -30,6 +30,9 @@ to be explicitly globalized.
3030
[--skip-wordpress]
3131
Execute code without loading WordPress.
3232

33+
[--hook=<hook>]
34+
Execute code after a specific WordPress hook has fired.
35+
3336
**EXAMPLES**
3437

3538
# Display WordPress content directory.
@@ -40,14 +43,18 @@ to be explicitly globalized.
4043
$ wp eval 'echo rand();' --skip-wordpress
4144
479620423
4245

46+
# Execute code after WordPress is fully loaded.
47+
$ wp eval 'echo "Current user: " . wp_get_current_user()->user_login;' --hook=wp_loaded
48+
Current user: admin
49+
4350

4451

4552
### wp eval-file
4653

4754
Loads and executes a PHP file.
4855

4956
~~~
50-
wp eval-file <file> [<arg>...] [--skip-wordpress] [--use-include]
57+
wp eval-file <file> [<arg>...] [--skip-wordpress] [--use-include] [--hook=<hook>]
5158
~~~
5259

5360
Note: because code is executed within a method, global variables need
@@ -67,6 +74,9 @@ to be explicitly globalized.
6774
[--use-include]
6875
Process the provided file via include instead of evaluating its contents.
6976

77+
[--hook=<hook>]
78+
Execute file after a specific WordPress hook has fired.
79+
7080
## Installing
7181

7282
This package is included with WP-CLI itself, no additional installation necessary.

0 commit comments

Comments
 (0)