• Resolved belbernard

    (@belbernard)


    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/

    However, if I save the post this alignment is no longer correct:
    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 to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Kathryn Presner

    (@zoonini)

    Hi @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/

    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

    (@belbernard)

    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

    (@zoonini)

    @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://www.ads-software.com/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

    (@belbernard)

    @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/)…

    Moderator Kathryn Presner

    (@zoonini)

    Heya @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

    If it works, perhaps this could be a workaround and give you more time to explore other themes?

    Thread Starter belbernard

    (@belbernard)

    @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

    (@zoonini)

    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.