PHPackages                             megumi/wp-post-helper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. megumi/wp-post-helper

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

megumi/wp-post-helper
=====================

0.5.0(11y ago)47221GPL2PHPPHP &gt;=5.3

Since Dec 12Pushed 11y ago9 watchersCompare

[ Source](https://github.com/megumiteam/wp-post-helper)[ Packagist](https://packagist.org/packages/megumi/wp-post-helper)[ RSS](/packages/megumi-wp-post-helper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (7)Used By (0)

megumi/wp-post-helper
=====================

[](#megumiwp-post-helper)

[![Build Status](https://camo.githubusercontent.com/6d925be83eb682e0856041fea7fe5b3cb49f2b3f8d297c77f3af1de6721f643e/68747470733a2f2f7472617669732d63692e6f72672f6d6567756d697465616d2f77702d706f73742d68656c7065722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/megumiteam/wp-post-helper) [![Latest Stable Version](https://camo.githubusercontent.com/22e2fe9d558a509b81bd658eef73a40eb2d204bbcf040230774d772e81148679/68747470733a2f2f706f7365722e707567782e6f72672f6d6567756d692f77702d706f73742d68656c7065722f762f737461626c652e737667)](https://packagist.org/packages/megumi/wp-post-helper) [![Total Downloads](https://camo.githubusercontent.com/36c3f776d7aad2a167ff7b49fffed5e55037590864e6f7ec68ac7ca517929748/68747470733a2f2f706f7365722e707567782e6f72672f6d6567756d692f77702d706f73742d68656c7065722f646f776e6c6f6164732e737667)](https://packagist.org/packages/megumi/wp-post-helper) [![Latest Unstable Version](https://camo.githubusercontent.com/9aa896a67a92fd2217d9658e95e9b6bd9ecab97e262a994aa77e58987103e972/68747470733a2f2f706f7365722e707567782e6f72672f6d6567756d692f77702d706f73742d68656c7065722f762f756e737461626c652e737667)](https://packagist.org/packages/megumi/wp-post-helper) [![License](https://camo.githubusercontent.com/ca7c60061583220a23a2039bea756e6c1619c5f4c01499050991ea309406f531/68747470733a2f2f706f7365722e707567782e6f72672f6d6567756d692f77702d706f73742d68656c7065722f6c6963656e73652e737667)](https://packagist.org/packages/megumi/wp-post-helper)

Helper class for the `wp_insert_post()`

Installation
------------

[](#installation)

Create a composer.json in your project root.

```
{
    "require": {
        "megumi/wp-post-helper": "*"
    }
}

```

Documentation
-------------

[](#documentation)

### Basic usage

[](#basic-usage)

```
$args = array(
    'post_name'    => 'slug',                  // slug
    'post_author'  => '1',                     // author's ID
    'post_date'    => '2012-11-15 20:00:00',   // post date and time
    'post_type'    => 'post',                 // post type (you can use custom post type)
    'post_status'  => 'publish',               // post status, publish, draft and so on
    'post_title'   => 'title',                 // post title
    'post_content' => 'content',               // post content
    'post_category'=> array( 1, 4 ),           // category IDs in an array
    'post_tags'    => array( 'tag1', 'tag2' ), // post tags in an array
);

$helper = new Megumi\WP\Post\Helper( $args );
$post_id = $helper->insert();

```

### Attachements

[](#attachements)

```
$args = array(
    ...
);

$helper = new Megumi\WP\Post\Helper( $args );
$post_id = $helper->insert();

$attachment_id = $helper->add_media(
    'http://placehold.jp/100x100.png', // path or url
    'title',
    'description',
    'caption',
    false
);

```

### Adding a value to a custom field

[](#adding-a-value-to-a-custom-field)

```
$args = array(
    ...
);

$helper = new Megumi\WP\Post\Helper( $args );
$post_id = $helper->insert();

$post->add_meta(
   'meta_key',  // meta key
   'meta_val',  // meta value
   true         // add it as unique (true) or not (false)
);

```

### Aadding a value as a format of Advanced Custom Field

[](#aadding-a-value-as-a-format-of-advanced-custom-field)

```
$args = array(
    ...
);

$helper = new Megumi\WP\Post\Helper( $args );
$post_id = $helper->insert();

$post->add_field(
   'field_xxxxxxxxxxxxx',   // key
   'field_val'          // value
);

```

Contributing
------------

[](#contributing)

Clone this project.

```
$ git clone git@github.com:megumiteam/wp-post-helper.git

```

### Run testing

[](#run-testing)

Initialize the testing environment locally:

(you'll need to already have mysql, svn and wget available)

```
$ bash bin/install-wp-tests.sh wordpress_test root '' localhost latest

```

Install phpunit.

```
$ composer install

```

The unit test files are in the `tests/` directory.

To run the unit tests, just execute:

```
$ phpunit

```

### Issue

[](#issue)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 59.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

5

Last Release

4154d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1366a673de80559a738e11fb4bd3600842f45ebc21abe8e2842e7205686a3ca0?d=identicon)[miya0001](/maintainers/miya0001)

---

Top Contributors

[![miya0001](https://avatars.githubusercontent.com/u/309946?v=4)](https://github.com/miya0001 "miya0001 (19 commits)")[![wokamoto](https://avatars.githubusercontent.com/u/804568?v=4)](https://github.com/wokamoto "wokamoto (12 commits)")[![hissy](https://avatars.githubusercontent.com/u/514294?v=4)](https://github.com/hissy "hissy (1 commits)")

### Embed Badge

![Health badge](/badges/megumi-wp-post-helper/health.svg)

```
[![Health](https://phpackages.com/badges/megumi-wp-post-helper/health.svg)](https://phpackages.com/packages/megumi-wp-post-helper)
```

###  Alternatives

[scheb/tombstone

Dead code detection with tombstones for PHP

282578.2k2](/packages/scheb-tombstone)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
