Title: className missing when saving image
Last modified: June 3, 2022

---

# className missing when saving image

 *  Resolved [belbernard](https://wordpress.org/support/users/belbernard/)
 * (@belbernard)
 * [4 years ago](https://wordpress.org/support/topic/classname-missing-when-saving-image/)
 * Hello,
 * After upgrading to WordPress 6.0, I am facing a problem with image alignment.
   
   It looks as if everything is normal, notice the right-aligned image on: [https://www.leti.lt/wordpress/accueil/](https://www.leti.lt/wordpress/accueil/)
 * However, if I save the post this alignment is no longer correct:
    [https://www.leti.lt/wordpress/aaaa/](https://www.leti.lt/wordpress/aaaa/)
 * I found that the problem can be worked around with a “surgical fix”: In the “
   wp:image” statement, a “className” declaration is missing. It should read:
 * <!– wp:image {“align”:”right”,”id”:23,”width”:224,”height”:148,”sizeSlug”:”large”,”
   className”:”alignright”} –>
 * So, adding “className”:”alignright” makes it work.
 * What can I change (possibly in functions.php) to get the proper “className” declarations(
   copied from figure class)?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fclassname-missing-when-saving-image%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/classname-missing-when-saving-image/#post-15740002)
 * Hi [@belbernard](https://wordpress.org/support/users/belbernard/), are you still
   having this issue or did you get it resolved?
 * > However, if I save the post this alignment is no longer correct:
   >  [https://www.leti.lt/wordpress/aaaa/](https://www.leti.lt/wordpress/aaaa/)
 * I’m seeing the class `alignleft` on the image on your test post there, is that
   what you expected to see? Or has the class somehow switched from `alignright`
   to `alignright` unexpectedly?
 * Let me know if you got things sorted or if you still need troubleshooting help.
   Thanks!
 *  Thread Starter [belbernard](https://wordpress.org/support/users/belbernard/)
 * (@belbernard)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/classname-missing-when-saving-image/#post-15740094)
 * Sorry, I had modified the page to make it look correct (with a left alignment).
   For this reason you did not notice the mentioned problem, which is still there.
 * So, now we’re back to “alignright” although the image again appears at the center
   because the “className” declaration is missing…
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/classname-missing-when-saving-image/#post-15740342)
 * [@belbernard](https://wordpress.org/support/users/belbernard/) Thanks for clarifying!
 * I tried to replicate your issue with the following setup, but so far haven’t 
   experienced the problem: the image-block alignment class remains after saving
   a post.
 * – WordPress 6.0
    – Twenty Twenty-Two theme – Gutenberg 13.4.0 (both active and
   inactive)
 * Could you please provide the following information to help me better understand
   how to replicate the issue:
 * – Is the issue present with the standalone Gutenberg plugin active, or does it
   go away?
    – If the issue is only present with the standalone Gutenberg plugin
   active, what version is it? – Is the issue present with **all** your plugins 
   temporarily deactivated? You can use the Health Check plugin for this, which 
   will not change your live site – [https://wordpress.org/plugins/health-check/](https://wordpress.org/plugins/health-check/)–
   Is the issue present with a default theme? Again, you can use the Health Check
   plugin for this so your live site isn’t affected.
 * Cheers.
 *  Thread Starter [belbernard](https://wordpress.org/support/users/belbernard/)
 * (@belbernard)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/classname-missing-when-saving-image/#post-15740809)
 * [@zoonini](https://wordpress.org/support/users/zoonini/)
 * Thanks for suggesting the Health Check plugin! It made things tremendously easy.
 * The result is that deactivating all extensions doesn’t solve the problem.
    I 
   also tried to suppress all Custom CSS, yet with no result.
 * Finally, the culprit is the TIMES theme which I am using in its latest version(
   1.5.2). The bad news are:
 * 1) It is no longer supported by CLYCO
    2) The support team no longer replies 
   emails, after being very cooperative over years 3) It seems a nightmare to switch
   my sites (except this one) to another theme because of lots of customizations
 * Therefore my first idea is to design a few code lines which could be implemented
   in “functions.php” (or any suitable file) so that the theme will survive a few
   more years.
 * My second idea is to find a theme that would reproduce great features of TIMES(
   such as on my site [https://lebonheurestpossible.org/](https://lebonheurestpossible.org/))…
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/classname-missing-when-saving-image/#post-15741050)
 * Heya [@belbernard](https://wordpress.org/support/users/belbernard/), I totally
   understand the potential hassle in switching themes, especially if you’ve done
   a lot of customizations.
 * I’m not sure what you could add to functions (or another file) to add back the
   block classes that your theme is stripping out, but I do wonder if you might 
   want to try manually adding the `alignright` or `alignleft` class name to your
   image blocks and see if they stick after saving.
 * You can add classes manually in the Advanced area of the block settings, as you
   see here:
 * [⌊Edit Page Self hosted Test WordPress⌉⌊Edit Page Self hosted Test WordPress⌉[
 * If it works, perhaps this could be a workaround and give you more time to explore
   other themes?
 *  Thread Starter [belbernard](https://wordpress.org/support/users/belbernard/)
 * (@belbernard)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/classname-missing-when-saving-image/#post-15741174)
 * [@zoonini](https://wordpress.org/support/users/zoonini/)
 * Yes it works! I hadn’t figured out this solution. Instead, I was editing the 
   page in code mode to declare the additional class. This will certainly be a viable
   workaround until the theme can be upgraded. Thanks for your patience!
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/classname-missing-when-saving-image/#post-15798679)
 * Great, thanks for confirming the workaround does the trick!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘className missing when saving image’ is closed to new replies.

 * ![](https://ps.w.org/gutenberg/assets/icon-256x256.jpg?rev=1776042)
 * [Gutenberg](https://wordpress.org/plugins/gutenberg/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gutenberg/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gutenberg/)
 * [Active Topics](https://wordpress.org/support/plugin/gutenberg/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gutenberg/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gutenberg/reviews/)

## Tags

 * [alignment](https://wordpress.org/support/topic-tag/alignment/)
 * [classname](https://wordpress.org/support/topic-tag/classname/)
 * [image](https://wordpress.org/support/topic-tag/image/)

 * 7 replies
 * 2 participants
 * Last reply from: [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/classname-missing-when-saving-image/#post-15798679)
 * Status: resolved