Title: Post Fixtures
Author: johncoswell
Published: <strong>January 18, 2010</strong>
Last modified: February 14, 2010

---

Search plugins

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://s.w.org/plugins/geopattern-icon/post-fixtures.svg)

# Post Fixtures

 By [johncoswell](https://profiles.wordpress.org/johncoswell/)

[Download](https://downloads.wordpress.org/plugin/post-fixtures.0.2.3.zip)

 * [Details](https://wordpress.org/plugins/post-fixtures/#description)
 * [Reviews](https://wordpress.org/plugins/post-fixtures/#reviews)
 *  [Installation](https://wordpress.org/plugins/post-fixtures/#installation)
 * [Development](https://wordpress.org/plugins/post-fixtures/#developers)

 [Support](https://wordpress.org/support/plugin/post-fixtures/)

## Description

Post Fixtures let you quickly tear down and set up test environments within your
development WordPress environment. This allows you to create post, category, and
options configurations to test specific issues and features of your themes and plugins.

**Post Fixtures** places a new menu item under _Tools_ called _Post Fixtures_. When
you visit the page, you’ll see a large textarea in which to copy and paste your 
JSON fixture data. Submitting the form with valid JSON data will cause your posts
and categories to be deleted & overwritten, and any options provided to be overwritten
or deleted.

As of the current release on GitHub, the following WordPress features are supported:

 * Posts
    - Most post data found in the `posts` table
    - Post metadata with serialization
 * Categories
 * Tags
 * Blog options with serialization and deletion

## Installation

Activate it like any other plugin. **Post Fixtures** requires PHP 5 or above.

## FAQ

#### What are the data formats accepted?

**JSON**

    ```
    {     "posts": [         {             "post_date": "2010-01-01 9:00am",             "post_title": "This is a sample post",             "post_content": "This is the post's content",             "categories": [ "Top Level 1/Sub Category 1", "Top Level 2/Sub Category 2" ],             "metadata": {                 "field-1": "value 1",                 "field-2": {                     "a_complex": "field",                     "with": [                         "lots", "of", "nested", "datatypes"                     ]                 }             },             "tags": "tag 1,tag 2"         },         {             "post_date": "2010-01-01 10:00am",             "post_title": "This is the second sample post",             "post_content": "This is the second post's content",             "categories": [ "Top Level 1/Sub Category 2", "Top Level 2/Sub Category 2" ]         }     ],     "options": {         "an-option-to-set": "simple-string",         "an-option-to-serialize": {             "this": "is a hash"         },         "an-option-to-delete": false     } } 
    ```

**PHP**

    ```
    // build an object immediately, and get the new post's ID $post_id = $builder->post('This is a sample post')                    ->date('2010-01-01 9:00am')                    ->content("This is the post's content")                    ->categories("Top Level 1/Sub Category 1,Top Level 2/Sub Category 2")                    ->metadata('field-1', 'value-1')                    ->metadata('field-2', array(                        'a_complex' => 'field',                        'with' => array(                         'lots', 'of', 'nested', 'datatypes'                        )                      ))                    ->tags('tag 1,tag 2')->build();  // build and object at the end, if order doesn't matter $builder->post('This is the second sample post')         ->date('2010-01-01 10:00am')         ->content("This is the second post's content")         ->categories("Top Level 1/Sub Category 2,Top Level 2/Sub Category 2")->defer();  // convenience wrapper around options setting $builder->option('an-option-to-set', 'simple-string')         ->option('an-option-to-serialize', array('this' => 'is a hash'))         ->option('an-option-to-delete', false); 
    ```

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

“Post Fixtures” is open source software. The following people have contributed to
this plugin.

Contributors

 *   [ johncoswell ](https://profiles.wordpress.org/johncoswell/)

[Translate “Post Fixtures” into your language.](https://translate.wordpress.org/projects/wp-plugins/post-fixtures)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/post-fixtures/), check
out the [SVN repository](https://plugins.svn.wordpress.org/post-fixtures/), or subscribe
to the [development log](https://plugins.trac.wordpress.org/log/post-fixtures/) 
by [RSS](https://plugins.trac.wordpress.org/log/post-fixtures/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 0.2.3

 * Clear cache after running fixtures. Needed for persistent caches.

#### 0.2.2

 * Bugfix for immediate build generation and sub-category addition when adding posts.

#### 0.2.1

 * Bugfix for multiple generated nested categories.

#### 0.2

 * Initial release on WordPress Plugins site.

## Meta

 *  Version **0.2.3**
 *  Last updated **16 years ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 2.8 or higher **
 *  Tested up to **2.9.2**
 * Tags
 * [admin](https://wordpress.org/plugins/tags/admin/)[database](https://wordpress.org/plugins/tags/database/)
   [developer](https://wordpress.org/plugins/tags/developer/)
 *  [Advanced View](https://wordpress.org/plugins/post-fixtures/advanced/)

## Ratings

No reviews have been submitted yet.

[Your review](https://wordpress.org/support/plugin/post-fixtures/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/post-fixtures/reviews/)

## Contributors

 *   [ johncoswell ](https://profiles.wordpress.org/johncoswell/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/post-fixtures/)

## Donate

Would you like to support the advancement of this plugin?

 [ Donate to this plugin ](http://www.coswellproductions.com/wordpress/wordpress-plugins)