xwp / unsplash-wp

GNU General Public License v2.0
9 stars 3 forks source link

Images do not attach to Block Editor posts #193

Closed postphotos closed 4 years ago

postphotos commented 4 years ago

Bug Description

images aren’t “attaching” to Block Editor posts, but do in Classic.

For context, regular images, when uploaded in either editor, are “attached” to a page.

Expected Behaviour

Images should attach to a post/page when uploaded, regardless of editor type (classic or block).

Currently it's just working on Classic.

Steps to reproduce

  1. Insert a post in block editor and see the media asset in the Media Library.
  2. Go to the media library's detached images and you'll see the block editor's images here /wp-admin/upload.php?mode=list&attachment-filter=detached
  3. Install/activate classic, and insert.
  4. Go back to the media screen and you'll see the images attached.

Screenshots

Additional context


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation brief

QA testing instructions

Demo

Changelog entry

postphotos commented 4 years ago

Also interesting, there is a related bug for Jetpack as well: https://github.com/Automattic/jetpack/issues/16425

ravichdev commented 4 years ago

The import process which handles the image import from Unsplash was not setting the current post ID as the post_parent to the imported image.

Classic editor has code to do the mapping after a post is uploaded, but the Block editor does not have that code. PR #199 adds code to set the post_parent to the current post ID during the import process.