-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce strip_dynamic_blocks() for excerpts #8984
Conversation
Initially used when generating excerpts to avoid infinite loops when dynamic blocks generate excerpts, and to add parity with `strip_shortcodes()`.
Incompatible with PHP 5.2
Tests fix for #5572.
strip_dynamic_blocks()
for excerpts
strip_dynamic_blocks()
for excerpts There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach works for me: dynamic blocks are functionally equivalent to shortcodes for this use case, it's quite reasonable to just strip them out. Nice work on the hack to get around the lack of convenient filter. 😉
The docblocks need to be filled out, but the implementation is otherwise good. Feel free to merge once you've updated them. 🙂
Very nice! Thank you very much! |
Description
Aims to fix #7268 by adding parity with
strip_shortcodes()
inwp_trim_excerpt()
.Aims to fix #5572 by removing dynamic blocks when generating excerpts to avoid infinite loops when dynamic blocks generate excerpts themselves.
How has this been tested?
I created a dynamic block that generated an excerpt in its callback, embedded it, and tested that it didn't create an out-of-memory error. Also added a small unit test to verify dynamic blocks are stripped.
Types of changes
get_shortcode_regex()
.strip_dynamic_blocks()
function.strip_dynamic_blocks()
.strip_dynamic_blocks()
when generating an excerpt.Checklist: