PHPackages                             kaiseki/wp-block-content-filter - 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. kaiseki/wp-block-content-filter

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

kaiseki/wp-block-content-filter
===============================

Filter and transform WordPress block render output through a configurable pipeline of per-block filters.

1.0.0(1mo ago)1697MITPHPPHP ^8.2CI passing

Since Jun 2Pushed 3w ago2 watchersCompare

[ Source](https://github.com/kaisekidev/kaiseki-wp-block-content-filter)[ Packagist](https://packagist.org/packages/kaiseki/wp-block-content-filter)[ Docs](https://github.com/kaisekidev/kaiseki-wp-block-content-filter)[ RSS](/packages/kaiseki-wp-block-content-filter/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (17)Versions (6)Used By (0)

kaiseki/wp-block-content-filter
===============================

[](#kaisekiwp-block-content-filter)

Filter and transform WordPress block render output through a configurable pipeline of per-block filters.

`BlockContentFilterRegistry` hooks into the `render_block` filter and, for each rendered block, runs the filters whose block-name pattern matches the block's `blockName` (matched with `fnmatch`, so `core/*` matches every core block). Each filter implements `BlockContentFilterInterface` and receives the rendered HTML plus the block's data, returning the (possibly transformed) HTML.

The package ships a few ready-made filters:

- **`CoreParagraphClassFilter` / `CoreHeadingClassFilter` / `CoreListClassFilter`** — add a CSS class to the outermost element of the rendered block.
- **`CoreHtmlWrapFilter`** — wrap the rendered block in a ``.
- **`DisableFullscreenMode`** — a standalone hook provider that turns off the block editor's fullscreen mode.

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

[](#installation)

```
composer require kaiseki/wp-block-content-filter
```

Requires PHP 8.2 or newer.

Usage
-----

[](#usage)

Register `ConfigProvider` with your laminas-style config aggregator, then declare a `block_content_filter` map of `fnmatch` block-name patterns to a list of filter class-strings (or instances). `ConfigProvider` already wires `BlockContentFilterRegistry` into `hook.provider`, so the registry runs automatically once `ConfigProvider` is registered — you only need to supply the filter map (do **not** add `BlockContentFilterRegistry` to `hook.provider` yourself, or it will be registered twice and the pipeline will run twice):

```
use Kaiseki\WordPress\BlockContentFilter\Filter\CoreHeadingClassFilter;
use Kaiseki\WordPress\BlockContentFilter\Filter\CoreParagraphClassFilter;

return [
    'block_content_filter' => [
        // Each key is an fnmatch pattern matched against the block's blockName.
        // Each value is a list of BlockContentFilterInterface class-strings (or
        // instances) run as a pipeline over the rendered block HTML.
        'core/paragraph' => [
            CoreParagraphClassFilter::class,
        ],
        'core/heading' => [
            CoreHeadingClassFilter::class,
        ],
    ],
];
```

Each filter class-string is resolved through the container (`Config::initClassMap`), so a filter that needs constructor arguments can be registered as a container service; the bundled filters work out of the box with sensible defaults.

The standalone `DisableFullscreenMode` provider is **not** registered by `ConfigProvider` — opt into it explicitly by adding it to your own `hook.provider` list:

```
use Kaiseki\WordPress\BlockContentFilter\DisableFullscreenMode;

return [
    'hook' => [
        'provider' => [
            DisableFullscreenMode::class,
        ],
    ],
];
```

Write your own filter by implementing `BlockContentFilterInterface`:

```
use Kaiseki\WordPress\BlockContentFilter\BlockContentFilterInterface;

final class MyFilter implements BlockContentFilterInterface
{
    /**
     * @param array $block
     */
    public function __invoke(string $content, array $block): string
    {
        return $content . '';
    }
}
```

Development
-----------

[](#development)

```
composer install
composer check    # check-deps, cs-check, phpstan
composer phpunit
```

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance95

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.3% 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

Unknown

Total

1

Last Release

31d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c3a6b11aea9668c9e9ca0c0f8515ef114d344acb552c695d715d35d5b388ea4?d=identicon)[woda](/maintainers/woda)

---

Top Contributors

[![wolfgangschaefer](https://avatars.githubusercontent.com/u/26325205?v=4)](https://github.com/wolfgangschaefer "wolfgangschaefer (7 commits)")[![davidmondok](https://avatars.githubusercontent.com/u/3883758?v=4)](https://github.com/davidmondok "davidmondok (4 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

wordpressmodule

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kaiseki-wp-block-content-filter/health.svg)

```
[![Health](https://phpackages.com/badges/kaiseki-wp-block-content-filter/health.svg)](https://phpackages.com/packages/kaiseki-wp-block-content-filter)
```

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k455.6M9.6k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.3k](/packages/illuminate-contracts)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M421](/packages/drupal-core-recommended)[illuminate/container

The Illuminate Container package.

31182.0M2.4k](/packages/illuminate-container)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[silverstripe/framework

The SilverStripe framework

7313.7M2.8k](/packages/silverstripe-framework)

PHPackages © 2026

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