diff --git a/CHANGELOG.md b/CHANGELOG.md index 33a9aaf..21b1bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [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 ### 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.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 diff --git a/includes/Frontend/TemplateLoader.php b/includes/Frontend/TemplateLoader.php index 822fc97..eb81955 100644 --- a/includes/Frontend/TemplateLoader.php +++ b/includes/Frontend/TemplateLoader.php @@ -258,11 +258,23 @@ class TemplateLoader { // 2. We're at depth > 1 (nested data loading) $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( 'id' => $post->ID, 'title' => get_the_title( $post ), '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 ), 'thumbnail' => get_the_post_thumbnail_url( $post->ID, 'large' ), 'date' => get_the_date( '', $post ), diff --git a/wp-fedistream.php b/wp-fedistream.php index e1b558d..c85cd44 100644 --- a/wp-fedistream.php +++ b/wp-fedistream.php @@ -3,7 +3,7 @@ * Plugin Name: 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. - * Version: 0.4.3 + * Version: 0.4.4 * Requires at least: 6.4 * Requires PHP: 8.3 * Author: Marco Graetsch @@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) { * * @var string */ -define( 'WP_FEDISTREAM_VERSION', '0.4.3' ); +define( 'WP_FEDISTREAM_VERSION', '0.4.4' ); /** * Plugin file path.