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

Removing Featured Image from Gutenberg post doesn't fully remove the featured media #1845

Open
joshdarby opened this issue Jan 23, 2020 · 0 comments
Labels
category: gutenberg Relating to general Gutenberg compatibility category: images Issues relating to images type: bug

Comments

@joshdarby
Copy link
Collaborator

joshdarby commented Jan 23, 2020

Originally reported by CIJN: INN/umbrella-caribbean#87

When editing a Guternberg post that has featured media, removing the featured media via the Featured Image metabox doesn't actually remove the featured media meta. It still partially exists, causing a blank gray area with no image to appear on the post:

73008675-0d64d480-3ddd-11ea-9c88-8b53eabbbbb2

The template uses largo_hero
https://github.com/INN/largo/blob/1744bbc7ae99f501129d158c3b585cddf6b5409e/partials/content-single.php#L32

which then calls largo_get_hero
https://github.com/INN/largo/blob/512da701664b329f2f92244bbe54880a6e146431/inc/featured-media.php#L55-L83

which then uses largo_get_featured_hero
https://github.com/INN/largo/blob/512da701664b329f2f92244bbe54880a6e146431/inc/featured-media.php#L106-L160

which returns

string(38) "
"

Example output of largo_get_featured_media after removing the featured image:

array(3) { ["type"]=> string(5) "image" ["attachment"]=> int(15) ["attachment_data"]=> array(32) { ["id"]=> int(15) ["title"]=> string(17) "cijn-logo-profile" ["filename"]=> string(21) "cijn-logo-profile.png" ["url"]=> string(71) "https://caribbean.test/wp-content/uploads/2019/11/cijn-logo-profile.png" ["link"]=> string(40) "https://caribbean.test/?attachment_id=15" ["alt"]=> string(0) "" ["author"]=> string(1) "1" ["description"]=> string(0) "" ["caption"]=> string(0) "" ["name"]=> string(17) "cijn-logo-profile" ["status"]=> string(7) "inherit" ["uploadedTo"]=> int(0) ["date"]=> int(1574701219000) ["modified"]=> int(1574701219000) ["menuOrder"]=> int(0) ["mime"]=> string(9) "image/png" ["type"]=> string(5) "image" ["subtype"]=> string(3) "png" ["icon"]=> string(59) "https://caribbean.test/wp-includes/images/media/default.png" ["dateFormatted"]=> string(17) "November 25, 2019" ["nonces"]=> array(3) { ["update"]=> string(10) "5f154d902c" ["delete"]=> string(10) "3bb8c61661" ["edit"]=> string(10) "ccc3489447" } ["editLink"]=> string(60) "https://caribbean.test/wp-admin/post.php?post=15&action=edit" ["meta"]=> bool(false) ["authorName"]=> string(5) "admin" ["filesizeInBytes"]=> int(10145) ["filesizeHumanReadable"]=> string(5) "10 KB" ["context"]=> string(0) "" ["height"]=> int(400) ["width"]=> int(400) ["orientation"]=> string(9) "landscape" ["sizes"]=> array(3) { ["thumbnail"]=> array(4) { ["height"]=> int(140) ["width"]=> int(140) ["url"]=> string(79) "https://caribbean.test/wp-content/uploads/2019/11/cijn-logo-profile-140x140.png" ["orientation"]=> string(9) "landscape" } ["medium"]=> array(4) { ["height"]=> int(336) ["width"]=> int(336) ["url"]=> string(79) "https://caribbean.test/wp-content/uploads/2019/11/cijn-logo-profile-336x336.png" ["orientation"]=> string(9) "landscape" } ["full"]=> array(4) { ["url"]=> string(71) "https://caribbean.test/wp-content/uploads/2019/11/cijn-logo-profile.png" ["height"]=> int(400) ["width"]=> int(400) ["orientation"]=> string(9) "landscape" } }

Workaround:
Select Hide on Single Post display under Featured Media on a post that this is happening on to make the empty gray area not appear.

@joshdarby joshdarby added type: bug category: gutenberg Relating to general Gutenberg compatibility category: images Issues relating to images labels Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: gutenberg Relating to general Gutenberg compatibility category: images Issues relating to images type: bug
Projects
None yet
Development

No branches or pull requests

1 participant