PHPackages                             php-stubs/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. php-stubs/wordpress-stubs

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

php-stubs/wordpress-stubs
=========================

WordPress function and class declaration stubs for static analysis.

v6.9.1(3mo ago)19513.0M↑21.9%23[11 issues](https://github.com/php-stubs/wordpress-stubs/issues)[4 PRs](https://github.com/php-stubs/wordpress-stubs/pulls)20MITPHPCI passing

Since Oct 12Pushed 2w ago3 watchersCompare

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

READMEChangelog (10)Dependencies (9)Versions (254)Used By (20)

Important

Hello everyone! This is Viktor who runs the php-stubs organization. I am planning to stop contributing to the WordPress ecosystem because it is extremely difficult and I do not earn (min) €100/month.

Please support my work to avoid abandoning this package.

[![Sponsor](https://github.com/szepeviktor/.github/raw/master/.github/assets/github-like-sponsor-button.svg)](https://github.com/sponsors/php-stubs)

Thank you!

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

[](#wordpress-stubs)

[![Packagist stats](https://camo.githubusercontent.com/ad6254386899b9f8bda099e2b514ec3530f1fd4a98e0e393d6cc6d4abd09bd14/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d73747562732f776f726470726573732d73747562732e737667)](https://packagist.org/packages/php-stubs/wordpress-stubs/stats)[![Packagist](https://camo.githubusercontent.com/4311cf355beb6b4d86a885f7b4f151413a22a2f4e266f62cb4f9f16c258cbe0d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068702d73747562732f776f726470726573732d73747562732e7376673f636f6c6f723d344343363145267374796c653d706f706f7574)](https://packagist.org/packages/php-stubs/wordpress-stubs)[![Build Status](https://github.com/php-stubs/wordpress-stubs/actions/workflows/integrate.yml/badge.svg)](https://github.com/php-stubs/wordpress-stubs/actions)

It provides stub declarations for [WordPress](https://wordpress.org/)core functions, classes and interfaces, **globals are not included**. These stubs can help plugin and theme developers leverage static analysis tools like [PHPStan](https://github.com/phpstan/phpstan).

The stubs are generated from [@johnpbloch's package](https://github.com/johnpbloch/wordpress-core)using [php-stubs/generator](https://github.com/php-stubs/generator).

### Requirements

[](#requirements)

- PHP 7.4 or 8.0

### Installation

[](#installation)

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

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

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

### Usage with PHPStan

[](#usage-with-phpstan)

```
composer require --dev szepeviktor/phpstan-wordpress
```

The package [`szepeviktor/phpstan-wordpress`](https://github.com/szepeviktor/phpstan-wordpress)depends on [`phpstan/phpstan`](http://github.com/phpstan/phpstan) and this one. Please do read [that package's README](https://github.com/szepeviktor/phpstan-wordpress/blob/master/README.md)and see the `example` directory over there.

### Usage with Psalm

[](#usage-with-psalm)

Update your Psalm config to include this section.

```

```

Furthermore ensure WordPress core is *not* included in ``.

### Usage in Intellisense

[](#usage-in-intellisense)

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

### Versioning

[](#versioning)

This package is versioned to match the WordPress version from which the stubs are generated.

### Generating stubs for a different WordPress version

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

1. Run modern PHP version
2. Clone this repository and `cd` into it
3. Update `"johnpbloch/wordpress": "x.x.x"` in `source/composer.json` with the desired version
4. Run `composer update`
5. And run `./generate.sh`

The `wordpress-stubs.php` file should now be updated.

###  Health Score

71

—

ExcellentBetter than 100% of packages

Maintenance88

Actively maintained with recent releases

Popularity65

Solid adoption and visibility

Community42

Growing community involvement

Maturity77

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~9 days

Recently: every ~31 days

Total

250

Last Release

104d ago

Major Versions

v5.9.3 → v6.0.02022-05-26

v5.9.4 → v6.0.22022-09-30

v5.9.5 → v6.0.32022-11-09

v5.9.6 → v6.0.42023-05-18

v5.9.9 → v6.0.52024-04-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/135d8104cdf926e2b15b6a06413153a9582729f0cd48ccba7bc7e62878a39781?d=identicon)[szepeviktor](/maintainers/szepeviktor)

---

Top Contributors

[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (337 commits)")[![IanDelMar](https://avatars.githubusercontent.com/u/42134098?v=4)](https://github.com/IanDelMar "IanDelMar (274 commits)")[![johnbillion](https://avatars.githubusercontent.com/u/208434?v=4)](https://github.com/johnbillion "johnbillion (71 commits)")[![GiacoCorsiglia](https://avatars.githubusercontent.com/u/15148404?v=4)](https://github.com/GiacoCorsiglia "GiacoCorsiglia (22 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (10 commits)")[![herndlm](https://avatars.githubusercontent.com/u/5738896?v=4)](https://github.com/herndlm "herndlm (10 commits)")[![lipemat](https://avatars.githubusercontent.com/u/1688181?v=4)](https://github.com/lipemat "lipemat (7 commits)")[![swissspidy](https://avatars.githubusercontent.com/u/841956?v=4)](https://github.com/swissspidy "swissspidy (6 commits)")[![janw-me](https://avatars.githubusercontent.com/u/1026882?v=4)](https://github.com/janw-me "janw-me (1 commits)")[![gin0115](https://avatars.githubusercontent.com/u/28779094?v=4)](https://github.com/gin0115 "gin0115 (1 commits)")[![MocioF](https://avatars.githubusercontent.com/u/26635356?v=4)](https://github.com/MocioF "MocioF (1 commits)")[![Nikschavan](https://avatars.githubusercontent.com/u/2931091?v=4)](https://github.com/Nikschavan "Nikschavan (1 commits)")[![PeterSmith8nss](https://avatars.githubusercontent.com/u/116166425?v=4)](https://github.com/PeterSmith8nss "PeterSmith8nss (1 commits)")

---

Tags

definitionsphpstanstatic-analysisstubswordpressPHPStanwordpressstatic analysis

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[php-stubs/woocommerce-stubs

WooCommerce function and class declaration stubs for static analysis.

942.9M66](/packages/php-stubs-woocommerce-stubs)[php-stubs/wp-cli-stubs

WP-CLI function and class declaration stubs for static analysis.

302.3M79](/packages/php-stubs-wp-cli-stubs)[php-stubs/wordpress-globals

Global variables and global constants from WordPress core.

13799.0k17](/packages/php-stubs-wordpress-globals)[johnbillion/wp-compat

PHPStan extension to help verify that your PHP code is compatible with a given version of WordPress

24115.0k10](/packages/johnbillion-wp-compat)

PHPackages © 2026

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