-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Removes the Post Content block from the inserter in the post editor #50620
Conversation
…s it can't be used there
Size Change: +5 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well in testing, and uses the same approach as for template parts, so this looks good to me 👍
Does this apply to all post types? Let's say a plugin adds an "event" post type to a WordPress Install. A reasonable use case for this plugin would be for a creator to utilize the Query Loop block to list out events in a post or a page. With this change, it appears this is something intentionally no longer supported? I definitely get the rationale for not enabling the relevant "post" content block for the viewed post type but this eliminates a whole class of potential use cases around utilizing content from other post types. |
@glendaviesnz to reiterate @nerrad, I think we need to look more closely at this. I 100% agree that the Post Content block should not be insertable in the Post Editor, but it should be insertable within a Query block in the Post Editor. This change potentially prevents a lot of reasonable Query layouts, especially once you involve CPTs.
Noting @jameskoster's comment in the original issue. Not sure how we accomplish this though 🤔 But at the end of the day, I think having the error message is better than also preventing the block in Query block. Edit: Also wanted to note that the error message does not display when the block is placed inside of a Query block (unless to prevent inception), only when placed outside of the block. |
Shouldnt that be possible with the ancestor property when registering the block? Or am I missing something obvious here? |
What?
Removes the Post content block from the inserter in the Post Editor
Why?
Fixes: #36870 This block just gives an error message about not being usable in a post, so no point in having it in the inserter there.
How?
Uses the same filter that is being used to stop the template part block being used in the Post editor
Testing Instructions
Screenshots or screencast
Before:
After: