Last Updated: February 25, 2016
·
871
· lccro

Wordpress REPL - Read, Eval, Print loop

Just like Python, Ruby, Lua or any scripting language you can use PHP's REPL to call wordpress functions and experiment with them locally.

Create a .PHP file with the following header:

<?php 
define('WP_USE_THEMES', false);
require('./wp-load.php');

Launch PHP's REPL:

$ php -a
php > _

Load your script:

php > require 'script_name.php';

Interact with Wordpress like there's no tomorrow:

php > print_r(get_user_by('id', 1));

Enjoy