PHPackages                             elcontraption/wp-post-inspector - 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. elcontraption/wp-post-inspector

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

elcontraption/wp-post-inspector
===============================

Tools for interacting and inspecting WordPress post objects.

0.1.5(8y ago)03561MITPHPPHP &gt;=5.4.0

Since Mar 18Pushed 8y ago1 watchersCompare

[ Source](https://github.com/elcontraption/wp-post-inspector)[ Packagist](https://packagist.org/packages/elcontraption/wp-post-inspector)[ RSS](/packages/elcontraption-wp-post-inspector/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (8)Used By (0)

WP Post Inspector
=================

[](#wp-post-inspector)

Tools for interacting and inspecting WordPress post objects.

- [Installation](#installation)
- [Retrieving a post object](#retrieving-a-post-object)
- [Methods](#methods)
- [Accessing post attributes](#accessing-post-attributes)
- [Traversing the post hierarchy](#traversing-a-post-hierarchy)

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

[](#installation)

Install as a dependency of your theme via composer:

```
composer require elcontraption/wp-post-inspector

```

Retrieving a post object
------------------------

[](#retrieving-a-post-object)

```
use \WpPostInspector\PostInspector;

// Get the current post object:
$currentPost = new PostInspector();

// Get a specific post object by ID
$post1 = new PostInspector(1);

// Get a specific post object by slug:
$helloWorldPost = new PostInspector('hello-world');
```

Methods
-------

[](#methods)

### ancestors

[](#ancestors)

Returns array of ancestors as PostInspector objects.

```
$currentPost->ancestors();
```

### descendants

[](#descendants)

Returns array of descendants as PostInspector objects.

```
$currentPost->descendants();
```

### parent

[](#parent)

Access parent PostInspector object.

```
$currentPost->parent();
```

### permalink

[](#permalink)

Shortcut for `get_permalink($currentPost->id())`.

```
$currentPost->permalink();
```

### siblings

[](#siblings)

Returns array of siblings as PostInspector objects.

```
$currentPost->siblings();
```

### top

[](#top)

Access the top ancestor as a PostInspector object.

```
$currentPost->top();
```

Accessing post attributes
-------------------------

[](#accessing-post-attributes)

You may either use standard WP\_Post attributes (as methods) or any of the shortcut methods built in to this class.

```
// Display the current post title using a shortcut method:
echo $currentPost->title(); // "Hello world!"

// Using a standard WP_Post attribute name:
echo $currentPost->post_title(); // "Hello world!"
```

Attribute nameShortcut methodIDidpost\_authorauthorpost\_datedatepost\_date\_gmtgmt or dateGmtpost\_contentcontentpost\_titletitlepost\_excerptexcerptpost\_statusstatuscomment\_statuscommentStatusping\_statuspingStatuspost\_passwordpasswordpost\_namename or slugto\_pingtoPingpingedpingedpost\_modifiedmodifiedpost\_modified\_gmtmodifiedGmtpost\_content\_filteredcontentFilteredpost\_parentparentguidguidmenu\_ordermenuOrderpost\_typetypepost\_mime\_typemimeTypecomment\_countcommentCountfilterfilter---

Traversing the post hierarchy
-----------------------------

[](#traversing-the-post-hierarchy)

You may traverse the post hierarchy using the `parent`, `top`, `ancestors`, `descendants`, and `siblings` methods:

```
// Get the parent of the current post object:
$parent = $currentPost->parent();

// Accessing attributes on the parent object:
echo $parent->slug();

// Display the title of the top ancestor post object
echo $currentPost->top()->title();

// The 'ancestors', 'descendants', and 'siblings' methods all return arrays of PostInspector objects:
$ancestors = $currentPost->ancestors();

foreach ($ancestors as $ancestor)
{
    var_dump($ancestor->title());
}

// Method chaining is possible:
$grandParent = $currentPost->parent()->parent();
$grandAunts = $currentPost->parent()->parent()->siblings();
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~190 days

Recently: every ~285 days

Total

7

Last Release

2983d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/67c2148e71cf45c053ed2dc8adfdb4c41188f52c732b9e48e5d9304714d6449f?d=identicon)[elcontraption](/maintainers/elcontraption)

---

Top Contributors

[![elcontraption](https://avatars.githubusercontent.com/u/33114?v=4)](https://github.com/elcontraption "elcontraption (14 commits)")

### Embed Badge

![Health badge](/badges/elcontraption-wp-post-inspector/health.svg)

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

###  Alternatives

[tapp/filament-timezone-field

Filament timezone field.

56349.9k7](/packages/tapp-filament-timezone-field)[xu42/open-sdk

有赞云服务端SDK

214.0k](/packages/xu42-open-sdk)

PHPackages © 2026

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