Last Updated: February 25, 2016
·
1.151K
· 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

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside