Hook: post.content.render
Last updated on May 21, 2026 05:06
Overview
Type: Filter
Location: app/Http/Resources/Api/V1/PostResource.php
Filters post HTML content before it is returned in API responses. Runs during resource serialization, allowing modules to inject or transform content dynamically.
Parameters
| Param | Type | Description |
|---|---|---|
$html |
string | Rendered HTML content |
$post |
Post | Post model instance |
Return
Must return string - modified HTML.
Usage Example
Append a copyright notice to every post:
Hook::addFilter('post.content.render', function (string $html, $post) {
return $html . '<p class="text-sm text-gray-500">Copyright ' . date('Y') . ' PolyCMS</p>';
});
Related Hooks
- content.render.html - Filter rendered block HTML
- content.render.blocks - Filter block array before rendering