PHPackages                             giacocorsiglia/wordpress-stubs - 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. giacocorsiglia/wordpress-stubs

ActiveLibrary

giacocorsiglia/wordpress-stubs
==============================

WordPress function, class, and global variable declaration stubs for easier static analysis.

v5.1.1(7y ago)35161.3k↓28.7%9[5 issues](https://github.com/GiacoCorsiglia/wordpress-stubs/issues)[1 PRs](https://github.com/GiacoCorsiglia/wordpress-stubs/pulls)11GPL-2.0+PHP

Since Feb 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/GiacoCorsiglia/wordpress-stubs)[ Packagist](https://packagist.org/packages/giacocorsiglia/wordpress-stubs)[ Docs](https://github.com/GiacoCorsiglia/wordpress-stubs)[ RSS](/packages/giacocorsiglia-wordpress-stubs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (17)Used By (11)

‼️ This project is not maintained ‼️
====================================

[](#️-this-project-is-not-maintained-️)

You should use the fork at [php-stubs/wordpress-stubs](https://github.com/php-stubs/wordpress-stubs), which is thanks to [@szepeviktor](https://github.com/szepeviktor).

---

WordPress Stubs
===============

[](#wordpress-stubs)

[![Build Status](https://camo.githubusercontent.com/83a46eb7eb18ee7a9aec556c0b4ffc81e70f1d3f60b7a714eb42ba4af2e09611/68747470733a2f2f7472617669732d63692e636f6d2f476961636f436f727369676c69612f776f726470726573732d73747562732e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/GiacoCorsiglia/wordpress-stubs)

This package provides stub declarations for [WordPress](https://wordpress.org/) core functions, classes, interfaces, and global variables. These stubs can help plugin and theme developers leverage static analysis tools like [Psalm](https://getpsalm.org/), which often dislike parsing all of WordPress.

The stubs are generated directly from the [source](https://github.com/johnpbloch/wordpress-core) using [giacocorsiglia/stubs-generator](https://github.com/GiacoCorsiglia/php-stubs-generator). Needless to say, this library repackages a subset of WordPress code, which is the work of the WordPress core developers. Granted, it's a useless subset without the real thing!

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

[](#installation)

Require this package as a dev-dependency with [Composer](https://getcomposer.org):

```
composer require --dev giacocorsiglia/wordpress-stubs

```

Alternatively, you may download `wordpress-stubs.php` directly.

Usage with Psalm
----------------

[](#usage-with-psalm)

Update your Psalm config to include the section:

```

```

Furthermore, ensure WordPress core code is *not* included under ``.

Usage for Intellisense
----------------------

[](#usage-for-intellisense)

If your editor has trouble parsing all of WordPress, you may find the stubs useful for enabling code completion and related features. For example, [here](https://github.com/bmewburn/vscode-intelephense/issues/113) are instructions for usage with VSCode's [Intelephense](https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client) extension. (In my experience, however, Intelephense parses WordPress core just fine.)

Versioning
----------

[](#versioning)

This package is versioned to match the WordPress version from which the stubs are generated. If any fixes to stubs are required, subsequent releases will be versioned as `WP_VERSION.X`.

Generating stubs for a different WordPress version
--------------------------------------------------

[](#generating-stubs-for-a-different-wordpress-version)

You should be running PHP 7.1 or later to follow these steps, so any function definitions that are polyfills for older versions of PHP are excluded from the stubs. Additionally, the Stubs Generator package at least requires PHP 7.1.

1. Clone this repository and `cd` into it.
2. Update `"johnpbloch/wordpress": "X.X.X"` in `composer.json` with your desired version.
3. Run `composer update`
4. Run `./generate.sh`

The `wordpress-stubs.php` file should now be updated. Feel free to submit a Pull Request if you'd like to see a release for a newer version. If things have fallen behind, please generate stubs for each missing version in a distinct commit so we can have a continuous release history.

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

[](#contributing)

Please have a look at [`CONTRIBUTING.md`](.github/CONTRIBUTING.md).

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 65.7% 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 ~28 days

Recently: every ~3 days

Total

15

Last Release

2623d ago

Major Versions

v4.9.9 → v5.0.02019-03-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/8cabc9efd157e2b47aa5aa9830180f5ebd07813cc3e93ff1a9993b2c3d264909?d=identicon)[localheinz](/maintainers/localheinz)

![](https://avatars.githubusercontent.com/u/15148404?v=4)[Giaco Corsiglia](/maintainers/GiacoCorsiglia)[@GiacoCorsiglia](https://github.com/GiacoCorsiglia)

---

Top Contributors

[![GiacoCorsiglia](https://avatars.githubusercontent.com/u/15148404?v=4)](https://github.com/GiacoCorsiglia "GiacoCorsiglia (23 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (10 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (2 commits)")

---

Tags

wordpressstatic analysis

### Embed Badge

![Health badge](/badges/giacocorsiglia-wordpress-stubs/health.svg)

```
[![Health](https://phpackages.com/badges/giacocorsiglia-wordpress-stubs/health.svg)](https://phpackages.com/packages/giacocorsiglia-wordpress-stubs)
```

###  Alternatives

[wp-coding-standards/wpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress coding conventions

2.8k42.5M1.6k](/packages/wp-coding-standards-wpcs)[automattic/vipwpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress VIP minimum coding conventions

25510.2M145](/packages/automattic-vipwpcs)[axepress/wp-graphql-cs

PHP\_CodeSniffer rules (sniffs) for the WPGraphQL ecosystem.

1060.9k7](/packages/axepress-wp-graphql-cs)

PHPackages © 2026

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