Skip to content

[Bug]: 'getMedia' is deprecated since version 6.9. #23111

@oskar-anderson

Description

@oskar-anderson

Prerequisites

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened

Admin post editor triggers a console warning when editing a post with a thumbnail image in Gutenberg editor:

'getMedia' is deprecated since version 6.9. Please use the 'postType', 'attachment' entity via the 'getEntityRecord' function instead.

Disabling the plugin causes the warning to disappear. The console warning points to this line:
imageData = select( "core" ).getMedia( featuredImageId );

Step-by-step reproduction instructions

  1. Go to edit a post with Gutenberg editor https://www.DOMAIN/wp-admin/post.php?post=54885&action=edit
  2. Check dev tools console.

Expected results

  1. No console warnings present

Actual results

  1. Deprecation console warning

Screenshots, screen recording, code snippet

No response

Which editor is affected (or editors)

  • Block Editor
  • Gutenberg Editor
  • Elementor Editor
  • Classic Editor
  • Other (please specify in additional info)

Which browser is affected (or browsers)

  • Chrome
  • Firefox
  • Safari
  • Other (please specify in additional info)

Device you are using

Desktop

Operating system

Windows 11

PHP version

8.2.28

WordPress version

6.9.4

WordPress Theme

Custom

Yoast SEO version

27.0

Gutenberg plugin version (if relevant)

No response

Elementor plugin version (if relevant)

No response

Classic Editor plugin version (if relevant)

No response

Relevant plugins in case of a bug

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions