Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WP 6.3-RC3: it is not possible to trash patterns with draft status in post editor #53367

Closed
bvlgn opened this issue Aug 5, 2023 · 2 comments · Fixed by #53405
Closed

WP 6.3-RC3: it is not possible to trash patterns with draft status in post editor #53367

bvlgn opened this issue Aug 5, 2023 · 2 comments · Fixed by #53405
Assignees
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@bvlgn
Copy link

bvlgn commented Aug 5, 2023

Description

If you add a new pattern in the post editor you will not get the row action option to trash the pattern.

This seems to be caused by map_meta_cap mapping delete_post cap to delete_blocks.(@line 153 in capabilities.php).
It looks this is not a default cap assigned to the administrator role, therefor administrators are not allowed to trash draft patterns. Which of course is a bug. See screenshot.

Step-by-step reproduction instructions

  1. Add a pattern in the post editor (wp-admin/edit.php?post_type=wp_block)
  2. Save it in draft status
  3. Go back to the list table
  4. Try to trash the pattern (the row action will not be there)

Screenshots, screen recording, code snippet

Scherm­afbeelding 2023-08-05 om 13 04 48

So $cap = 'delete_blocks', which is not in $capabilities:

Scherm­afbeelding 2023-08-05 om 12 47 33

Environment info

WP 6.3 RC3

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@bvlgn bvlgn changed the title WP 6.3-RC3: is it not possible to trash patterns with draft status in post editor WP 6.3-RC3: it is not possible to trash patterns with draft status in post editor Aug 5, 2023
@glendaviesnz glendaviesnz added [Type] Bug An existing feature does not function as intended [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Aug 6, 2023
@glendaviesnz
Copy link
Contributor

Thanks @bvlgn, I was able to replicate this, but I could also replicate it with reusable blocks on 6.2.2 so given it is an existing bug not introduced by the pattern changes in 6.3 I don't think we need to prioritise it for 6.3 - but it would be good to get this sorted, so have added to the patterns project board.

@ramonjd
Copy link
Member

ramonjd commented Aug 8, 2023

Would something like this be an interim plugin fix?

If so I can then add a WP backport patch to add delete_posts to the register_post_type args.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants