Insights on Ruby, Git, jQuery, Cappuccino, WordPress, Debian and OS X. Please subscribe if you find something useful!

Introducing the WordPress Console

Posted: June 23rd, 2009 | Author: Jerod | Filed under: Projects, WordPress | Tags: | Comments

One killer feature of Ruby on Rails (for me) is script/console. Being able to interact with your code and data inside the full Rails environment is a powerful tool for development. Some days I practically live there, and if I get carried away, I do a lot of my testing there too (bad, I know).

I love Ruby and Rails, but being a contract developer means I go where the money is and recently that has been in WordPress plugin development. I enjoy developing for WordPress, but I’ve been spoiled by Rails and I often long for an interactive console for WordPress.

As a result, I’ve been developing (and using) a Wordpress plugin built for Wordpress developers. It provides an in-browser console where you can “play” with the code you’re working on.

If a picture is worth 1,000 words, this screencast will be worth at least a bazillion of ‘em:

So there you have it. It is currently version 0.1.0 (very young) and I would love some help to make it even more awesome. The source code is hosted on GitHub, so please fork away and I’d be happy to merge in your changes.

Or, simply go download the plugin and try it.

*NOTE*
In developing this plugin, I leaned on a few other open-source projects for inspiration (and in some cases, code). They are:

I thank the authors for opening their source.


  • Really useful, thanks
  • Glad I'm not the only Rails-lovin' wordpress junkie!
  • interesting post ...And really cool that is new information to me..Console :-)
    As a ruby developer I dint know that.
  • I also get the syntax error running on localhost. Must be a permissions problem, but I'm going to work right now, so no time to fool with it.
  • Hi Joseph-

    I'd be interested in hearing if you can figure out what the problem is. It very well could be a permissions error. As I suggested to scribu above, check the apache (or whatever server) error log to see if PHP is puking anything out there.

    Let me know what you find and hopefully we can get you all fixed up!
  • Added your first issue at github, link to patch included. As is the plugin is negligently insecure (but outstandingly cool and useful and I want this plugin to be installable, thus the patch) http://github.com/sant0sk1/wordpress-console/is...
  • Hah, yah if you see the description I state plainly that it should never be run in production environments. Regardless, I'll definitely check out your patch and get it merged in ASAP. Thanks!
  • Great!
    Realy usefull
    Thanks a lot
  • scribu
    Very neat ideea.

    However, when I try to execute something, I always get "Error: Most likely syntax. Forget the semicolon? If not, try 'reload' and re-execute".

    I even tried some of the exact commands from your screencast.

    I'm running a WP 2.8.1beta install on localhost.
  • Hmm, that is very strange.

    If you are running on localhost, that means you probably have access to the logs files, yes? If so, can you please look at your web server's error log and see if it states any PHP errors? That may shed some light on the problem.
  • scribu
    I got this error:

    File does not exist: /var/www/wp-content, referer:
    http://localhost/wp/wp-admin/tools.php?page=wor...

    Instead of /var/www/wp-content
    it should be /var/www/wp/wp-content

    --
    http://scribu.net
  • ok, a fix has been released. Please try version 0.1.2 and let me know if it fixes the problem. Thanks!
  • scribu
    It's working now, thanks.
  • Squintz
    I'm having this problem with 0.2.1. Any ideas?
  • Hi Squintz.

    First, I just released a new version (0.2.2) which is compatible with WordPress 2.9. Please upgrade to that and try again. If the problem still persists, please check your web server's error logs for any help and let me know what they say. I'd be happy to help figure out a fix.
  • Ok, I see the problem. The plugin is assuming your WordPress install is in the server root directory and not hanging off of a subdirectory. I'll work up a fix and release a new version ASAP.
  • I'm getting the same error. My local install is in my home directory so the path should be..

    /Users/joey/Sites/wordpress/wp-content

    ..but the error_log is spitting..

    /Library/WebServer/Documents/wp-content

    I tried hard coding it into console.js, but that doesn't seem to help so I'm not sure where it's going wrong. Look forward to seeing the solution.
  • Jerod, this #wordpress console is great for peeps learning php and the wp API thanks!
  • Yah, good point I didn't think of that. It could be a great learning tool as well!
  • Awesome! This is a great concept and initial steps towards a great tool. /bookmarked for good measure.

    (lots of Zak/zac/zack/zach..s...running around these days...apparently )
  • Zac
    That is a pretty hot plugin, thanks!
blog comments powered by Disqus