Skip to content
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

Fix wp:image block created for attachments #184

Merged
merged 2 commits into from
Nov 21, 2024
Merged

Conversation

akirk
Copy link
Owner

@akirk akirk commented Nov 13, 2024

The code currently produced creates an invalid block:

<!-- wp:image {"id":"10040","sizeSlug":"large"} -->
<figure class="wp-block-image"><img src="https://example.com/wp-content/uploads/sites/4/2024/11/Tusky-Test_1731495973955_M8D7KUL8U8-scaled.jpg" width="2560" height="1920" alt="" class="wp-image-10040"/></figure>
<!-- /wp:image -->

Screenshot 2024-11-13 at 12 14 30

We need to make the id an integer and remove width and height.

<!-- wp:image {"id":10040,"sizeSlug":"large"} -->
<figure class="wp-block-image"><img src="https://example.com/wp-content/uploads/sites/4/2024/11/Tusky-Test_1731495973955_M8D7KUL8U8-scaled.jpg" alt="" class="wp-image-10040"/></figure>
<!-- /wp:image -->

@akirk akirk changed the title Ensure that the image id is an integer Fix wp:image block created for attachments Nov 13, 2024
@akirk akirk merged commit 97c4519 into main Nov 21, 2024
18 checks passed
@akirk akirk deleted the fix-image-post-invalid branch November 21, 2024 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant