sfjwebsfj
Forum Replies Created
-
Forum: Requests and Feedback
In reply to: FSE Block Editor – Excerpt Block 100 Word LimitSolution: I was able to create a custom block that doesn’t abbreviate the excerpt.
- This reply was modified 1 year, 3 months ago by sfjwebsfj. Reason: marked as resolved
Forum: Requests and Feedback
In reply to: FSE Block Editor – Excerpt Block 100 Word LimitHi Caio, thank you for your reply and solution, but it unfortunately didn’t work for me, both through functions.php and Code Snippets. (Actually, I had already tried the add_filter method and given up.) Since then, I’ve been digging deep into creating a custom excerpt block and found this comment and code in the core post-excerpt block (index.php):
/* * The purpose of the excerpt length setting is to limit the length of both * automatically generated and user-created excerpts. * Because the excerpt_length filter only applies to auto generated excerpts, * wp_trim_words is used instead. */ $excerpt_length = $attributes['excerptLength']; $excerpt = get_the_excerpt( $block->context['postId'] ); if ( isset( $excerpt_length ) ) { $excerpt = wp_trim_words( $excerpt, $excerpt_length ); }
So, yeah, they are truncating user-created excerpts with intention. I have been battling this for days and have searched the world over. The only reason given for altering the user-created excerpts, that I have found, is so that if you are using a grid-based layout it will come out more aesthetically pleasing. That is such bad logic it makes me want to cry. That is a challenge for the theme to overcome, not the core.
Then, to really make sure that YOUR website is the way THEY want it to be, they added this at the end of index.php:
/** * If themes or plugins filter the excerpt_length, we need to * override the filter in the editor, otherwise * the excerpt length block setting has no effect. * Returns 100 because 100 is the max length in the setting. */ if ( is_admin() || defined( 'REST_REQUEST' ) && REST_REQUEST ) { add_filter( 'excerpt_length', static function () { return 100; }, PHP_INT_MAX ); }
And that is why the intended method of add_filter for making these kinds of changes doesn’t work. Apparently this was added 3 months ago.
Authors, there does not need to be a max length to achieve your layout goals, which you shouldn’t even have at the core level!
Again, Caio, thank you for your reply. I wish the people that coded the post-excerpt block would listen.
I deleted the entire wflogs folder from wp-content. Thank you, that seems to have fixed it. In the config.php file, I could see where the serialized array was broken. Don’t know why, but I’ll watch it. Thank you again!