You've already forked wp-fedistream
fix: Prevent get_the_excerpt() from triggering the_content filter
All checks were successful
Create Release Package / build-release (push) Successful in 58s
All checks were successful
Create Release Package / build-release (push) Successful in 58s
- get_the_excerpt() internally calls the_content filter when generating auto-excerpts - When in shortcode context, now uses raw post_excerpt or wp_trim_words() instead - This was the remaining recursion path causing memory exhaustion Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
11
CHANGELOG.md
11
CHANGELOG.md
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.4.4] - 2026-02-02
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **Fix excerpt-triggered recursion** - `get_the_excerpt()` internally calls `the_content` filter when generating auto-excerpts
|
||||||
|
- When in shortcode context, now uses raw `$post->post_excerpt` or generates simple excerpt with `wp_trim_words()` instead
|
||||||
|
- This was the remaining recursion path causing memory exhaustion in `class-wp-hook.php`
|
||||||
|
|
||||||
## [0.4.3] - 2026-02-02
|
## [0.4.3] - 2026-02-02
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
@@ -226,7 +234,8 @@ Initial release of WP FediStream - a WordPress plugin for streaming music over A
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
[Unreleased]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.3...HEAD
|
[Unreleased]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.4...HEAD
|
||||||
|
[0.4.4]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.3...v0.4.4
|
||||||
[0.4.3]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.2...v0.4.3
|
[0.4.3]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.2...v0.4.3
|
||||||
[0.4.2]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.1...v0.4.2
|
[0.4.2]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.1...v0.4.2
|
||||||
[0.4.1]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.0...v0.4.1
|
[0.4.1]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.0...v0.4.1
|
||||||
|
|||||||
@@ -258,11 +258,23 @@ class TemplateLoader {
|
|||||||
// 2. We're at depth > 1 (nested data loading)
|
// 2. We're at depth > 1 (nested data loading)
|
||||||
$skip_content_filter = self::$shortcode_context_depth > 0 || self::$recursion_depth > 1;
|
$skip_content_filter = self::$shortcode_context_depth > 0 || self::$recursion_depth > 1;
|
||||||
|
|
||||||
|
// When skipping content filter, also use raw excerpt to avoid get_the_excerpt()
|
||||||
|
// triggering the_content filter internally when generating auto-excerpts.
|
||||||
|
if ( $skip_content_filter ) {
|
||||||
|
$excerpt = $post->post_excerpt;
|
||||||
|
if ( empty( $excerpt ) ) {
|
||||||
|
// Generate a simple excerpt without triggering the_content filter.
|
||||||
|
$excerpt = wp_trim_words( wp_strip_all_tags( $post->post_content ), 55, '…' );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$excerpt = get_the_excerpt( $post );
|
||||||
|
}
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'id' => $post->ID,
|
'id' => $post->ID,
|
||||||
'title' => get_the_title( $post ),
|
'title' => get_the_title( $post ),
|
||||||
'content' => $skip_content_filter ? wp_kses_post( $post->post_content ) : apply_filters( 'the_content', $post->post_content ),
|
'content' => $skip_content_filter ? wp_kses_post( $post->post_content ) : apply_filters( 'the_content', $post->post_content ),
|
||||||
'excerpt' => get_the_excerpt( $post ),
|
'excerpt' => $excerpt,
|
||||||
'permalink' => get_permalink( $post ),
|
'permalink' => get_permalink( $post ),
|
||||||
'thumbnail' => get_the_post_thumbnail_url( $post->ID, 'large' ),
|
'thumbnail' => get_the_post_thumbnail_url( $post->ID, 'large' ),
|
||||||
'date' => get_the_date( '', $post ),
|
'date' => get_the_date( '', $post ),
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: WP FediStream
|
* Plugin Name: WP FediStream
|
||||||
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wp-fedistream
|
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wp-fedistream
|
||||||
* Description: Stream music over ActivityPub - Build your own music streaming platform for Musicians and Labels.
|
* Description: Stream music over ActivityPub - Build your own music streaming platform for Musicians and Labels.
|
||||||
* Version: 0.4.3
|
* Version: 0.4.4
|
||||||
* Requires at least: 6.4
|
* Requires at least: 6.4
|
||||||
* Requires PHP: 8.3
|
* Requires PHP: 8.3
|
||||||
* Author: Marco Graetsch
|
* Author: Marco Graetsch
|
||||||
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
define( 'WP_FEDISTREAM_VERSION', '0.4.3' );
|
define( 'WP_FEDISTREAM_VERSION', '0.4.4' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin file path.
|
* Plugin file path.
|
||||||
|
|||||||
Reference in New Issue
Block a user