How WordPress 6.9 Editor Changes Impact Your Custom Blocks

I recently sat down with a client who was pulling his hair out over a custom “Media Portfolio” block we’d inherited from another agency. The problem was subtle but maddening: a user would update an image caption in the editor, save the post, and… nothing. Or sometimes it would update, but then revert when they edited another part of the block. Total nightmare. It turned out to be a classic data desynchronization issue between two different ways WordPress was handling media in the background.

My first instinct, honestly? I thought about just hammering the REST API cache with a hard reset every time the block focused. It’s the kind of “obvious” fix you reach for when you’re in a hurry. But that’s a rookie move. It kills performance and doesn’t actually solve the underlying race condition. The real fix—and the reason I’m writing this—lies in how the WordPress 6.9 editor changes are finally cleaning up the way the Block Editor handles data entities.

The Media vs. Attachment Entity Mess

For a long time, the @wordpress/core-data package had a bit of an identity crisis. It maintained a media entity and an attachment entity. Both pointed to the same REST API endpoint, but they lived in separate caches. If your code updated one and another part of the UI read from the other, you got stale data. Trust me on this, it’s been the source of countless “ghost bugs” in complex builds.

In WordPress 6.9, as noted in the official dev notes, the media entity is officially deprecated. You need to move everything to attachment. Here is how you should be refactoring your data calls to keep things stable:

// The old, deprecated way
wp.data.select( 'core' ).getMedia( 123 );

// The bbioon-approved, stable way for 6.9+
wp.data.select( 'core' ).getEntityRecord( 'postType', 'attachment', 123 );

// If you're dispatching updates
wp.data.dispatch( 'core' ).saveEntityRecord( 'postType', 'attachment', 123, { 
    caption: { raw: 'New bbioon Caption' } 
} );

Notice the caption change? The attachment entity returns the caption as an object with raw and rendered properties, whereas the old media entity sometimes flattened it to a string. If your frontend components expect a string, your UI is going to break. It’s a small detail, but it’s exactly the kind of thing that causes a site-wide crash if you aren’t paying attention.

Atomic Updates with setAttributes

Another massive improvement in the WordPress 6.9 editor changes is support for updater functions in setAttributes. This is huge for anyone building complex blocks. Previously, if you had two rapid-fire events trying to update a block’s state (like two toggle switches clicked in a millisecond), they could overwrite each other because they were both calculating the “new” state based on a “current” state that was already stale. This is a textbook race condition.

Now, we can pass a pure function. It ensures you’re always working with the absolute latest state of the attributes. It looks like this:

const bbioonToggleFeature = () => {
    setAttributes( ( currentAttributes ) => ( {
        isFeatureEnabled: ! currentAttributes.isFeatureEnabled,
    } ) );
};

Watch Out for SelectControl CSS Shifts

One last thing—and this is for the devs who do a lot of custom editor styling. The SelectControl component moved its class names from an internal div to the root element. If you have CSS selectors that look like .components-base-control .my-custom-class, they might stop working because the classes are now on the same element. It’s a “small” change that can ruin a perfectly polished admin UI in seconds.

So, What’s the Point?

WordPress is maturing. The editor isn’t just a playground anymore; it’s becoming a robust data-driven application. Migrating away from deprecated entities like media isn’t just about avoiding console warnings—it’s about making sure your clients don’t call you at 10 PM because their images are “acting weird.” This is very similar to how we had to handle the transition in the old get_posts days, just with more JavaScript.

Look, this stuff gets complicated fast. If you’re tired of debugging someone else’s mess and just want your site to work with the latest core standards, drop my team a line. We’ve probably seen it before.

Are you still using the old media selectors in your custom blocks, or have you already made the jump to the attachment entity?

author avatar
Ahmad Wael

Leave a Reply

Your email address will not be published. Required fields are marked *