• Hello – foremost, thank you for this helpful plugin!

    I’ve experienced a possible bug when attempting to apply attributes to IMAGE blocks.

    I added the following attributes to a paragraph block:

    • data-rellax-percentage (with a value of “0.5”)
    • data-rellax-speed (with a value of “1”)

    And the <p> tag was accurately modified to be <p data-rellax-speed="1" data-rellax-percentage="0.5"> on the front-end.

    Then, I added the following attributes to an image block:

    • data-rellax-speed (with a value of “1”)
    • sample-attribute (with a value of “123”)

    But, on the front-end, the <figure> tag had duplicate instance of each value, resulting in <figure class="wp-block-image size-large" sample-attribute="123 123" data-rellax-speed="1 1">

    I performed this test on a basic install of WordPress (latest) with the “Twenty Twenty-Two” theme (latest) after experiencing the same issue on another site. (both sites are local, so I can’t provide a live example)

    Thanks again for your work on this appreciated plugin!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Copernicus

    (@copernicus)

    Small updates/notes:

    • When I check in the ‘Code Editor’ view (instead of the ‘Visual Editor’), it shows the attribute values displaying as expected (i.e. not duplicated)
    • I’ve found that if I switch to use the ‘override‘ mode on the attribute and then re-save the issue no longer occurs (it accurately displays one instance of the value on the front-end).
    Plugin Author websevendev

    (@websevendev)

    Thanks for reporting, I can reproduce it.

    Looks like this happens when a block’s JS edit function returns block content but the block also has a PHP render_callback that returns block content. So this plugin’s filters are applied twice.

    Luckily override mode can negate this as I don’t have time to fix it before next month.

    Thread Starter Copernicus

    (@copernicus)

    OK, thank you for looking into it.

    Yes — the override mode is working to negate this (for anyone else who might experience the issue before it can be fixed).

    Thanks again for your work on this plugin – it fills a gap in what, as others have noted, “should be in core.” ??

    Hello and thanks a lot for the plugin

    I had similar problem and others, just in case that it is useful for you next month.

    I got duplicate ids also, but I don’t know exactly when because I had another problem and I came here to search and I found this thread, so I looked and found some.

    The problem that I had was when I was working with the plugin and learning about the code on the page (going from visual to code editor and back).

    One of the times, after going to the code one, and deleting some spacers, blocks with attributes from your plugin got corrupted and I used the block tool to recover. Some times I had to do it twice for it stop warning to me.

    Then I went to the code and found that it was changing the characters (especially “), like here

    <!– wp:group {“attributesForBlocks”:{“data-parent”:”#collapse1″,”labelledby”:”headingOne”,”id”:”collapse1″},”className”:”collapse”} –>
    <div id=”collapse1 collapse1″ class=”wp-block-group collapse” data-parent=”#collapse1″ labelledby=”headingOne”><!– wp:heading {“level”:6,”attributesForBlocks”:{“id=\u0022actions\u0022 class=\u0022collapse\u0022 aria-labelledby=\u0022headingOne\u0022 data-parent=\u0022#accordion\u0022 “:””},”textColor”:”tertiary”} –>
    <h6 class=”has-tertiary-color has-text-color”>A1 Initiation and coordination of preparatory actions</h6>
    <!– /wp:heading –>

    Also you can see the id duplicated. I wasn’t using override at the moment. I was trying to make a bootstrap collapse and putting the attributes with your plugin.

    This happened several times. Now I use override but I am worried that classes or attributes made by others overridden and I loose other functionalities.

    But I was able at the end to make the page and now it is working, thanks!

    Have a good day ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Possible Bug: Duplicated Values in Attributes for Images’ is closed to new replies.