If you have multiple dynamic blocks with a post loop on a page, how do you avoid duplicates from inside the render_callback function?

In PHP I recall these ways Static variables Class properties Databases, Files, Memory (might be flushed though) to preserve a state, in a hook’s callback, that is called multiple times in WordPress and in the order I would consider using myself but it depends on the context (eg WP transients, that store data that expires, … Read more

Modify src attribute on image block

You want to take a look at the Codex about Block Filters. You’ll need to make a filter using add_filter and hook into render_callback by re-registering core/image and modifying the render callback. Checkout this WPSE post from uruk.