Build Status

Access your WordPress database with Ruby.

Read more:


Add this line to your application's Gemfile:

gem 'ruby-wordpress', :require => 'wordpress'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ruby-wordpress


require 'wordpress'
wp = options

Initialization options

A symbol hash.

See the mysql2 connection options.

Additional options:

  • :wordpress_prefix (default: 'wp_')
  • :wordpress_wp_content (used for uploading attachments)



Bug fixes

  • WordPress#query :post_type accepts an Array parameter now.
  • MySQL 5.6 "strict mode" error complaining about the format of dates is now fixed.


  • 1.8.7 is no longer supported.


Bug fixes

  • WordPress::Post#set_post_terms will now respect the append parameter, when true.
  • WordPress::Post#set_post_terms now accepts an empty array as the terms argument.
  • WordPress#query :meta_query now correctly queries for multiple meta query statements. Only AND is supported at this point.
  • WordPress#query :meta_query :type is now respected correctly
  • WordPress#query :meta_query BETWEEN, NOT BETWEEN, IN, NOT IN works as expected.

New features

  • PHP serialization for Ruby arrays and hashes in WordPress::Options
  • 1.8.7 syntax support
  • Added WordPress::Post#==. Comparison is performed only with IDs now.


  • Bug fixes
  • Post meta
  • Taxonomy functions
  • Adds post meta queries


  • Initial public release
  • Basic SQL functions (WordPress::Base)
  • wp_options accessor


Hack away! Just make sure you have your test_configuration.yml file set up correctly. There's an example in test_configuration.example.yml; you can copy this and tailor it to your environment.

Please do not use a real database for testing - it is wiped clean before the suite runs, and loads the attached WordPress default schema.

The default rake task will run the entire test suite.


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request