-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
[Block] Post Featured ImageAffects the Post Featured Image BlockAffects the Post Featured Image Block[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] PerformanceRelated to performance effortsRelated to performance efforts
Description
Description
While working on Accurate sizes: Add support for core/post-featured-image block, I noticed that the render_block_core_post_featured_image()
function calls get_the_title( $post_ID )
twice when generating the alt
attribute for the featured image.
This can be slightly optimized for performance and clarity by storing the post title in a local variable before using it. This avoids redundant function calls and improves readability.
Step-by-step reproduction instructions
- Create a post with a title and featured image.
- Use a Post Featured Image block in a page or post.
- View the rendered markup and confirm the alt attribute reflects the post title.
- Remove the title and confirm that the fallback logic still applies correctly.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
felixarntz and luckybhumkar
Metadata
Metadata
Assignees
Labels
[Block] Post Featured ImageAffects the Post Featured Image BlockAffects the Post Featured Image Block[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] PerformanceRelated to performance effortsRelated to performance efforts