-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Post Images: add new method to detect images from Gutenberg blocks (#…
…11000) * Post Images: add new method to detect images from Gutenberg blocks Fixes #10501 - This new method parses all HTML content using WP's parse_blocks. - We only select Core image blocks. - We also remove any image blocks that do not include a post ID. This is because image blocks that do not have a post ID are currently inserted using the "from image URL" option in the image block picker. As such, all the info in that block is the image URL; we have no data about image size for those images. * Use new method to get data when extracting from attachments * Unit Tests: avoid failures for WP versions that do not support GB. * Add support for core Gallery blocks * Add support for Tiled Gallery block * Return empty string when no content instead of using undefined var * Fix the behaviour of get_post_html - It should be able to return the post URL when possible. - When it does not return any post content (like an empty string), it should be handled properly. - We should fetch the post URL and not the post title. * Fixed block image retrieval to not return empty arrays. This resulted in warnings because an opengraph tag function has tried to access the 'src' attribute of an empty array. Now the block parser doesn't return an empty array in case the image data is not found or not good enough. * Fixed one more case where false results needed to be filtered out.
- Loading branch information
Showing
2 changed files
with
348 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.